This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5693bd
commit b12a152
Showing
5 changed files
with
193 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from unittest import TestCase | ||
from neo.VM.InteropService import * | ||
from neo.VM.ExecutionEngine import ExecutionEngine | ||
from neo.VM.ExecutionEngine import ExecutionContext | ||
from neo.VM import OpCode | ||
|
||
|
||
class VMTestCase(TestCase): | ||
|
||
engine = None | ||
econtext = None | ||
|
||
def setUp(self): | ||
|
||
self.engine = ExecutionEngine() | ||
self.econtext = ExecutionContext() | ||
|
||
def test_add_operations(self): | ||
|
||
self.engine.EvaluationStack.PushT(StackItem.New(2)) | ||
self.engine.EvaluationStack.PushT(StackItem.New(3)) | ||
|
||
self.engine.ExecuteOp(OpCode.ADD, self.econtext) | ||
|
||
self.assertEqual(len(self.engine.EvaluationStack.Items), 1) | ||
|
||
self.assertEqual(self.engine.EvaluationStack.Items[0], StackItem.New(5)) | ||
|
||
def test_sub_operations(self): | ||
|
||
self.engine.EvaluationStack.PushT(StackItem.New(2)) | ||
self.engine.EvaluationStack.PushT(StackItem.New(3)) | ||
|
||
self.engine.ExecuteOp(OpCode.SUB, self.econtext) | ||
|
||
self.assertEqual(len(self.engine.EvaluationStack.Items), 1) | ||
|
||
self.assertEqual(self.engine.EvaluationStack.Items[0], StackItem.New(-1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters