vm_test.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // Copyright 2014 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum 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. // go-ethereum 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 go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package tests
  17. import (
  18. "path/filepath"
  19. "testing"
  20. )
  21. // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail.
  22. func TestVMArithmetic(t *testing.T) {
  23. fn := filepath.Join(vmTestDir, "vmArithmeticTest.json")
  24. if err := RunVmTest(fn, VmSkipTests); err != nil {
  25. t.Error(err)
  26. }
  27. }
  28. func TestBitwiseLogicOperation(t *testing.T) {
  29. fn := filepath.Join(vmTestDir, "vmBitwiseLogicOperationTest.json")
  30. if err := RunVmTest(fn, VmSkipTests); err != nil {
  31. t.Error(err)
  32. }
  33. }
  34. func TestBlockInfo(t *testing.T) {
  35. fn := filepath.Join(vmTestDir, "vmBlockInfoTest.json")
  36. if err := RunVmTest(fn, VmSkipTests); err != nil {
  37. t.Error(err)
  38. }
  39. }
  40. func TestEnvironmentalInfo(t *testing.T) {
  41. fn := filepath.Join(vmTestDir, "vmEnvironmentalInfoTest.json")
  42. if err := RunVmTest(fn, VmSkipTests); err != nil {
  43. t.Error(err)
  44. }
  45. }
  46. func TestFlowOperation(t *testing.T) {
  47. fn := filepath.Join(vmTestDir, "vmIOandFlowOperationsTest.json")
  48. if err := RunVmTest(fn, VmSkipTests); err != nil {
  49. t.Error(err)
  50. }
  51. }
  52. func TestLogTest(t *testing.T) {
  53. fn := filepath.Join(vmTestDir, "vmLogTest.json")
  54. if err := RunVmTest(fn, VmSkipTests); err != nil {
  55. t.Error(err)
  56. }
  57. }
  58. func TestPerformance(t *testing.T) {
  59. fn := filepath.Join(vmTestDir, "vmPerformanceTest.json")
  60. if err := RunVmTest(fn, VmSkipTests); err != nil {
  61. t.Error(err)
  62. }
  63. }
  64. func TestPushDupSwap(t *testing.T) {
  65. fn := filepath.Join(vmTestDir, "vmPushDupSwapTest.json")
  66. if err := RunVmTest(fn, VmSkipTests); err != nil {
  67. t.Error(err)
  68. }
  69. }
  70. func TestVMSha3(t *testing.T) {
  71. fn := filepath.Join(vmTestDir, "vmSha3Test.json")
  72. if err := RunVmTest(fn, VmSkipTests); err != nil {
  73. t.Error(err)
  74. }
  75. }
  76. func TestVm(t *testing.T) {
  77. fn := filepath.Join(vmTestDir, "vmtests.json")
  78. if err := RunVmTest(fn, VmSkipTests); err != nil {
  79. t.Error(err)
  80. }
  81. }
  82. func TestVmLog(t *testing.T) {
  83. fn := filepath.Join(vmTestDir, "vmLogTest.json")
  84. if err := RunVmTest(fn, VmSkipTests); err != nil {
  85. t.Error(err)
  86. }
  87. }
  88. func TestInputLimits(t *testing.T) {
  89. fn := filepath.Join(vmTestDir, "vmInputLimits.json")
  90. if err := RunVmTest(fn, VmSkipTests); err != nil {
  91. t.Error(err)
  92. }
  93. }
  94. func TestInputLimitsLight(t *testing.T) {
  95. fn := filepath.Join(vmTestDir, "vmInputLimitsLight.json")
  96. if err := RunVmTest(fn, VmSkipTests); err != nil {
  97. t.Error(err)
  98. }
  99. }
  100. func TestVMRandom(t *testing.T) {
  101. fns, _ := filepath.Glob(filepath.Join(baseDir, "RandomTests", "*"))
  102. for _, fn := range fns {
  103. if err := RunVmTest(fn, VmSkipTests); err != nil {
  104. t.Error(err)
  105. }
  106. }
  107. }