github.com/bamzi/go-ethereum@v1.6.7-0.20170704111104-138f26c93af1/tests/transaction_test.go (about)

     1  // Copyright 2015 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package tests
    18  
    19  import (
    20  	"math/big"
    21  	"path/filepath"
    22  	"testing"
    23  
    24  	"github.com/ethereum/go-ethereum/params"
    25  )
    26  
    27  func TestTransactions(t *testing.T) {
    28  	config := &params.ChainConfig{}
    29  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "ttTransactionTest.json"), TransSkipTests)
    30  	if err != nil {
    31  		t.Fatal(err)
    32  	}
    33  }
    34  
    35  func TestWrongRLPTransactions(t *testing.T) {
    36  	config := &params.ChainConfig{}
    37  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "ttWrongRLPTransaction.json"), TransSkipTests)
    38  	if err != nil {
    39  		t.Fatal(err)
    40  	}
    41  }
    42  
    43  func Test10MBTransactions(t *testing.T) {
    44  	config := &params.ChainConfig{}
    45  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "tt10mbDataField.json"), TransSkipTests)
    46  	if err != nil {
    47  		t.Fatal(err)
    48  	}
    49  }
    50  
    51  // homestead tests
    52  func TestHomesteadTransactions(t *testing.T) {
    53  	config := &params.ChainConfig{
    54  		HomesteadBlock: big.NewInt(0),
    55  	}
    56  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttTransactionTest.json"), TransSkipTests)
    57  	if err != nil {
    58  		t.Fatal(err)
    59  	}
    60  }
    61  
    62  func TestHomesteadWrongRLPTransactions(t *testing.T) {
    63  	config := &params.ChainConfig{
    64  		HomesteadBlock: big.NewInt(0),
    65  	}
    66  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttWrongRLPTransaction.json"), TransSkipTests)
    67  	if err != nil {
    68  		t.Fatal(err)
    69  	}
    70  }
    71  
    72  func TestHomestead10MBTransactions(t *testing.T) {
    73  	config := &params.ChainConfig{
    74  		HomesteadBlock: big.NewInt(0),
    75  	}
    76  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "tt10mbDataField.json"), TransSkipTests)
    77  	if err != nil {
    78  		t.Fatal(err)
    79  	}
    80  }
    81  
    82  func TestHomesteadVitalik(t *testing.T) {
    83  	config := &params.ChainConfig{
    84  		HomesteadBlock: big.NewInt(0),
    85  	}
    86  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttTransactionTestEip155VitaliksTests.json"), TransSkipTests)
    87  	if err != nil {
    88  		t.Fatal(err)
    89  	}
    90  }
    91  
    92  func TestTxEIP155Transaction(t *testing.T) {
    93  	config := &params.ChainConfig{
    94  		ChainId:        big.NewInt(1),
    95  		HomesteadBlock: big.NewInt(0),
    96  		EIP155Block:    big.NewInt(0),
    97  	}
    98  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTest.json"), TransSkipTests)
    99  	if err != nil {
   100  		t.Fatal(err)
   101  	}
   102  }
   103  
   104  func TestTxEIP155VitaliksTests(t *testing.T) {
   105  	config := &params.ChainConfig{
   106  		ChainId:        big.NewInt(1),
   107  		HomesteadBlock: big.NewInt(0),
   108  		EIP155Block:    big.NewInt(0),
   109  	}
   110  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTestEip155VitaliksTests.json"), TransSkipTests)
   111  	if err != nil {
   112  		t.Fatal(err)
   113  	}
   114  }
   115  
   116  func TestTxEIP155VRule(t *testing.T) {
   117  	config := &params.ChainConfig{
   118  		ChainId:        big.NewInt(1),
   119  		HomesteadBlock: big.NewInt(0),
   120  		EIP155Block:    big.NewInt(0),
   121  	}
   122  	err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTestVRule.json"), TransSkipTests)
   123  	if err != nil {
   124  		t.Fatal(err)
   125  	}
   126  }