Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Feb 27, 2019
1 parent df2c5a5 commit cd3fc12
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/neo-vm.Tests/Tests/OpCodes/Exceptions/THROW.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"category": "Exceptions",
"name": "THROW",
"tests":
[
{
"script": "0xF0",
"trigger": "Application",
"steps":
[
{
"actions":
[
"StepInto"
],
"result":
{
"state":
[
"Fault",
"Break"
],
"invocationStack":
[
{
"scriptHash": "0x639095273057429f0475642a711b0ff24bee5f7d",
"instructionPointer": 1,
"nextInstruction": "RET"
}
]
}
}
]
}
]
}
110 changes: 110 additions & 0 deletions tests/neo-vm.Tests/Tests/OpCodes/Exceptions/THROWIFNOT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"category": "Exceptions",
"name": "THROWIFNOT",
"tests":
[
{
"script": "0x0091F1",
"trigger": "Application",
"name": "Without throw exception",
"steps":
[
{
"actions":
[
"StepInto",
"StepInto",
"StepInto"
],
"result":
{
"state":
[
"Break"
],
"invocationStack":
[
{
"scriptHash": "0xB596C875BC46FB5E2DFA4C74071B6BF965D740DE",
"instructionPointer": 3,
"nextInstruction": "RET"
}
]
}
},
{
"actions":
[
"StepInto"
],
"result":
{
"state":
[
"Halt",
"Break"
]
}
}
]
},
{
"script": "0x00F1",
"trigger": "Application",
"name": "Throw exception (with PUSH)",
"steps":
[
{
"actions":
[
"Execute"
],
"result":
{
"state":
[
"Fault"
],
"invocationStack":
[
{
"scriptHash": "0x58B88C67B9F19BB9BB4C2C418B44A398D722DF54",
"instructionPointer": 2,
"nextInstruction": "RET"
}
]
}
}
]
},
{
"script": "0xF1",
"trigger": "Application",
"name": "Throw exception (without PUSH - FAULT)",
"steps":
[
{
"actions":
[
"Execute"
],
"result":
{
"state":
[
"Fault"
],
"invocationStack":
[
{
"scriptHash": "0x52C8881BB60A00778972B84150C43B25A19C766E",
"instructionPointer": 1,
"nextInstruction": "RET"
}
]
}
}
]
}
]
}
1 change: 1 addition & 0 deletions tests/neo-vm.Tests/UtVMJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class UtVMJson : VMJsonTestBase
[Theory]
[InlineData("./Tests/Others")]
[InlineData("./Tests/OpCodes/Stack")]
[InlineData("./Tests/OpCodes/Exceptions")]
public void TestJson(string path)
{
foreach (var file in Directory.GetFiles(path, "*.json", SearchOption.AllDirectories))
Expand Down

0 comments on commit cd3fc12

Please sign in to comment.