Skip to content

Commit

Permalink
micheline test cases fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarreif committed Feb 4, 2021
1 parent ae65eac commit 1cf26fd
Show file tree
Hide file tree
Showing 25 changed files with 609 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,4 @@
]
]
}
]
]
1 change: 1 addition & 0 deletions test/chain/tezos/lexer/samples/p008-opcodes/maps.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0000033502000003300501076507650860035b036800000002256d04680000000225780765066303680000000225790663036800000002257a0500076407640764046c0000001425746573745f6765745f616e645f7570646174650860035b03680000000d25746573745f6d61705f67657407640860035b03680000000e25746573745f6d61705f676574320860035b03680000001c25746573745f6d61705f6765745f64656661756c745f76616c756573076407640860035b03680000001b25746573745f6d61705f6765745f6d697373696e675f76616c75650860035b03680000001c25746573745f6d61705f6765745f6d697373696e675f76616c75653207640860035b03680000001125746573745f6d61705f6765745f6f7074046c0000001025746573745f7570646174655f6d6170050202000001fe03210317034c0316072e0200000102072e0200000082072e0200000044034c03210571000203160316074305630368050901000000036f6e650743035b0001038c034c0320034c0320034c03210316034c0317031605700002034c0342034c03420200000032034c03210317034c03160316057000020743035b000c0329072f02000000080743035b000c03270200000000034c034203420200000074072e0200000032034c03210317034c03160316057000020743035b000c0329072f02000000080743035b001103270200000000034c034203420200000036034c03210317034c03160316057000020743035b000c0329072f020000000c0743036801000000036162630200000000034c0342034202000000e2072e020000007e072e020000003f034c03210317034c03160316057000020743035b000c0329072f020000001507430368010000000a6d697373696e6720313203270200000000034c034203420200000033034c03210317034c03160316057000020743035b000c0329072f02000000090743035b00921303270200000000034c034203420200000058072e020000001e034c03210316034c03170317057000020743035b000c03290342034c0342020000002e032003210317034c031603210317034c0316074305630368050901000000036f6e650743035b0001035003420342053d036d0342
255 changes: 255 additions & 0 deletions test/chain/tezos/lexer/samples/p008-opcodes/maps.micheline
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
[
{
"prim": "storage",
"args": [
{
"prim": "pair",
"args": [
{ "prim": "pair", "args": [ { "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%m" ] }, { "prim": "string", "annots": [ "%x" ] } ] },
{
"prim": "pair",
"args": [ { "prim": "option", "args": [ { "prim": "string" } ], "annots": [ "%y" ] }, { "prim": "option", "args": [ { "prim": "string" } ], "annots": [ "%z" ] } ]
}
]
}
]
},
{
"prim": "parameter",
"args": [
{
"prim": "or",
"args": [
{
"prim": "or",
"args": [
{
"prim": "or",
"args": [
{ "prim": "unit", "annots": [ "%test_get_and_update" ] },
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get" ] }
]
},
{
"prim": "or",
"args": [
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get2" ] },
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get_default_values" ] }
]
}
]
},
{
"prim": "or",
"args": [
{
"prim": "or",
"args": [
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get_missing_value" ] },
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get_missing_value2" ] }
]
},
{
"prim": "or",
"args": [
{ "prim": "map", "args": [ { "prim": "int" }, { "prim": "string" } ], "annots": [ "%test_map_get_opt" ] },
{ "prim": "unit", "annots": [ "%test_update_map" ] }
]
}
]
}
]
}
]
},
{
"prim": "code",
"args": [
[
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{
"prim": "IF_LEFT",
"args": [
[
{
"prim": "IF_LEFT",
"args": [
[
{
"prim": "IF_LEFT",
"args": [
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "DUG", "args": [ { "int": "2" } ] },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "PUSH", "args": [ { "prim": "option", "args": [ { "prim": "string" } ] }, { "prim": "Some", "args": [ { "string": "one" } ] } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "1" } ] },
{ "prim": "GET_AND_UPDATE" },
{ "prim": "SWAP" },
{ "prim": "DROP" },
{ "prim": "SWAP" },
{ "prim": "DROP" },
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CAR" },
{ "prim": "SWAP" },
{ "prim": "CDR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "SWAP" },
{ "prim": "PAIR" }
],
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "IF_NONE", "args": [ [ { "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] }, { "prim": "FAILWITH" } ], [] ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
]
]
}
],
[
{
"prim": "IF_LEFT",
"args": [
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "IF_NONE", "args": [ [ { "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "17" } ] }, { "prim": "FAILWITH" } ], [] ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
],
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "IF_NONE", "args": [ [ { "prim": "PUSH", "args": [ { "prim": "string" }, { "string": "abc" } ] } ], [] ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
]
]
}
]
]
}
],
[
{
"prim": "IF_LEFT",
"args": [
[
{
"prim": "IF_LEFT",
"args": [
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "IF_NONE", "args": [ [ { "prim": "PUSH", "args": [ { "prim": "string" }, { "string": "missing 12" } ] }, { "prim": "FAILWITH" } ], [] ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
],
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "CAR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "IF_NONE", "args": [ [ { "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "1234" } ] }, { "prim": "FAILWITH" } ], [] ] },
{ "prim": "SWAP" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
]
]
}
],
[
{
"prim": "IF_LEFT",
"args": [
[
{ "prim": "SWAP" },
{ "prim": "DUP" },
{ "prim": "CAR" },
{ "prim": "SWAP" },
{ "prim": "CDR" },
{ "prim": "CDR" },
{ "prim": "DIG", "args": [ { "int": "2" } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "12" } ] },
{ "prim": "GET" },
{ "prim": "PAIR" },
{ "prim": "SWAP" },
{ "prim": "PAIR" }
],
[
{ "prim": "DROP" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "DUP" },
{ "prim": "CDR" },
{ "prim": "SWAP" },
{ "prim": "CAR" },
{ "prim": "PUSH", "args": [ { "prim": "option", "args": [ { "prim": "string" } ] }, { "prim": "Some", "args": [ { "string": "one" } ] } ] },
{ "prim": "PUSH", "args": [ { "prim": "int" }, { "int": "1" } ] },
{ "prim": "UPDATE" },
{ "prim": "PAIR" },
{ "prim": "PAIR" }
]
]
}
]
]
}
]
]
},
{ "prim": "NIL", "args": [ { "prim": "operation" } ] },
{ "prim": "PAIR" }
]
]
}
]

0 comments on commit 1cf26fd

Please sign in to comment.