|
1 | 1 | package tests |
2 | 2 |
|
3 | | -import "testing" |
| 3 | +import ( |
| 4 | + "os" |
| 5 | + "path/filepath" |
| 6 | + "testing" |
| 7 | +) |
| 8 | + |
| 9 | +var stateTestDir = filepath.Join(baseDir, "StateTests") |
4 | 10 |
|
5 | 11 | func TestStateSystemOperations(t *testing.T) { |
6 | | - const fn = "../files/StateTests/stSystemOperationsTest.json" |
| 12 | + fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json") |
7 | 13 | RunVmTest(fn, t) |
8 | 14 | } |
9 | 15 |
|
10 | 16 | func TestStateExample(t *testing.T) { |
11 | | - const fn = "../files/StateTests/stExample.json" |
| 17 | + fn := filepath.Join(stateTestDir, "stExample.json") |
12 | 18 | RunVmTest(fn, t) |
13 | 19 | } |
14 | 20 |
|
15 | 21 | func TestStatePreCompiledContracts(t *testing.T) { |
16 | | - const fn = "../files/StateTests/stPreCompiledContracts.json" |
| 22 | + fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json") |
17 | 23 | RunVmTest(fn, t) |
18 | 24 | } |
19 | 25 |
|
20 | 26 | func TestStateRecursiveCreate(t *testing.T) { |
21 | | - const fn = "../files/StateTests/stRecursiveCreate.json" |
| 27 | + fn := filepath.Join(stateTestDir, "stRecursiveCreate.json") |
22 | 28 | RunVmTest(fn, t) |
23 | 29 | } |
24 | 30 |
|
25 | 31 | func TestStateSpecial(t *testing.T) { |
26 | | - const fn = "../files/StateTests/stSpecialTest.json" |
| 32 | + fn := filepath.Join(stateTestDir, "stSpecialTest.json") |
27 | 33 | RunVmTest(fn, t) |
28 | 34 | } |
29 | 35 |
|
30 | 36 | func TestStateRefund(t *testing.T) { |
31 | | - const fn = "../files/StateTests/stRefundTest.json" |
| 37 | + fn := filepath.Join(stateTestDir, "stRefundTest.json") |
32 | 38 | RunVmTest(fn, t) |
33 | 39 | } |
34 | 40 |
|
35 | 41 | func TestStateBlockHash(t *testing.T) { |
36 | | - const fn = "../files/StateTests/stBlockHashTest.json" |
| 42 | + fn := filepath.Join(stateTestDir, "stBlockHashTest.json") |
37 | 43 | RunVmTest(fn, t) |
38 | 44 | } |
39 | 45 |
|
40 | 46 | func TestStateInitCode(t *testing.T) { |
41 | | - const fn = "../files/StateTests/stInitCodeTest.json" |
| 47 | + fn := filepath.Join(stateTestDir, "stInitCodeTest.json") |
42 | 48 | RunVmTest(fn, t) |
43 | 49 | } |
44 | 50 |
|
45 | 51 | func TestStateLog(t *testing.T) { |
46 | | - const fn = "../files/StateTests/stLogTests.json" |
| 52 | + fn := filepath.Join(stateTestDir, "stLogTests.json") |
47 | 53 | RunVmTest(fn, t) |
48 | 54 | } |
49 | 55 |
|
50 | 56 | func TestStateTransaction(t *testing.T) { |
51 | | - const fn = "../files/StateTests/stTransactionTest.json" |
| 57 | + fn := filepath.Join(stateTestDir, "stTransactionTest.json") |
52 | 58 | RunVmTest(fn, t) |
53 | 59 | } |
54 | 60 |
|
55 | 61 | func TestCallCreateCallCode(t *testing.T) { |
56 | | - const fn = "../files/StateTests/stCallCreateCallCodeTest.json" |
| 62 | + fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") |
57 | 63 | RunVmTest(fn, t) |
58 | 64 | } |
59 | 65 |
|
60 | 66 | func TestMemory(t *testing.T) { |
61 | | - const fn = "../files/StateTests/stMemoryTest.json" |
| 67 | + fn := filepath.Join(stateTestDir, "stMemoryTest.json") |
62 | 68 | RunVmTest(fn, t) |
63 | 69 | } |
64 | 70 |
|
65 | 71 | func TestMemoryStress(t *testing.T) { |
66 | 72 | if os.Getenv("TEST_VM_COMPLEX") == "" { |
67 | 73 | t.Skip() |
68 | 74 | } |
69 | | - const fn = "../files/StateTests/stMemoryStressTest.json" |
| 75 | + fn := filepath.Join(stateTestDir, "stMemoryStressTest.json") |
70 | 76 | RunVmTest(fn, t) |
71 | 77 | } |
72 | 78 |
|
73 | 79 | func TestQuadraticComplexity(t *testing.T) { |
74 | 80 | if os.Getenv("TEST_VM_COMPLEX") == "" { |
75 | 81 | t.Skip() |
76 | 82 | } |
77 | | - const fn = "../files/StateTests/stQuadraticComplexityTest.json" |
| 83 | + fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json") |
78 | 84 | RunVmTest(fn, t) |
79 | 85 | } |
80 | 86 |
|
81 | 87 | func TestSolidity(t *testing.T) { |
82 | | - const fn = "../files/StateTests/stSolidityTest.json" |
| 88 | + fn := filepath.Join(stateTestDir, "stSolidityTest.json") |
83 | 89 | RunVmTest(fn, t) |
84 | 90 | } |
85 | 91 |
|
86 | 92 | func TestWallet(t *testing.T) { |
87 | | - const fn = "../files/StateTests/stWalletTest.json" |
| 93 | + fn := filepath.Join(stateTestDir, "stWalletTest.json") |
88 | 94 | RunVmTest(fn, t) |
89 | 95 | } |
90 | 96 |
|
91 | 97 | func TestStateTestsRandom(t *testing.T) { |
92 | | - fns, _ := filepath.Glob("../files/StateTests/RandomTests/*") |
| 98 | + fns, _ := filepath.Glob("./files/StateTests/RandomTests/*") |
93 | 99 | for _, fn := range fns { |
94 | 100 | RunVmTest(fn, t) |
95 | 101 | } |
|
0 commit comments