aboutsummaryrefslogtreecommitdiffstats
path: root/vm_test.go
diff options
context:
space:
mode:
authorobscuren <obscuren@obscura.com>2014-01-04 07:32:52 +0800
committerobscuren <obscuren@obscura.com>2014-01-04 07:32:52 +0800
commit2d3c3674faa2c9c15d4ab27c7dc6b3e07a532780 (patch)
tree620540f7299aec1f3bc9dd7151d2421a0d2ab534 /vm_test.go
parent6ab61f2c524686e479f9546d5ce2529f3b8eb7fe (diff)
downloadgo-tangerine-2d3c3674faa2c9c15d4ab27c7dc6b3e07a532780.tar.gz
go-tangerine-2d3c3674faa2c9c15d4ab27c7dc6b3e07a532780.tar.zst
go-tangerine-2d3c3674faa2c9c15d4ab27c7dc6b3e07a532780.zip
Updated stack based vm
Diffstat (limited to 'vm_test.go')
-rw-r--r--vm_test.go59
1 files changed, 51 insertions, 8 deletions
diff --git a/vm_test.go b/vm_test.go
index fe0358a42..efcd875cd 100644
--- a/vm_test.go
+++ b/vm_test.go
@@ -7,23 +7,66 @@ import (
func TestVm(t *testing.T) {
+ InitFees()
+
db, _ := NewMemDatabase()
Db = db
- ctrct := NewTransaction("", 20, []string{
- "PUSH",
- "1a2f2e",
- "PUSH",
- "hallo",
+ ctrct := NewTransaction("", 200000000, []string{
+ "PUSH", "1a2f2e",
+ "PUSH", "hallo",
"POP", // POP hallo
- "PUSH",
- "3",
+ "PUSH", "3",
"LOAD", // Load hallo back on the stack
+
+ "PUSH", "1",
+ "PUSH", "2",
+ "ADD",
+
+ "PUSH", "2",
+ "PUSH", "1",
+ "SUB",
+
+ "PUSH", "100000000000000000000000",
+ "PUSH", "10000000000000",
+ "SDIV",
+
+ "PUSH", "105",
+ "PUSH", "200",
+ "MOD",
+
+ "PUSH", "100000000000000000000000",
+ "PUSH", "10000000000000",
+ "SMOD",
+
+ "PUSH", "5",
+ "PUSH", "10",
+ "LT",
+
+ "PUSH", "5",
+ "PUSH", "5",
+ "LE",
+
+ "PUSH", "50",
+ "PUSH", "5",
+ "GT",
+
+ "PUSH", "5",
+ "PUSH", "5",
+ "GE",
+
+ "PUSH", "10",
+ "PUSH", "10",
+ "NOT",
+
+ "MYADDRESS",
+ "TXSENDER",
+
"STOP",
})
tx := NewTransaction("1e8a42ea8cce13", 100, []string{})
- block := CreateBlock("", 0, "", "", 0, 0, "", []*Transaction{ctrct, tx})
+ block := CreateBlock("", 0, "", "c014ba53", 0, 0, "", []*Transaction{ctrct, tx})
db.Put(block.Hash(), block.MarshalRlp())
bm := NewBlockManager()