Skip to content

Commit

Permalink
Update failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Sep 10, 2024
1 parent 65ce867 commit cd3031b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions packages/cashc/test/generation/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const fixtures: Fixture[] = [
{ ip: 47, line: 10 },
{ ip: 59, line: 13 },
],
sourceMap: '3:16:3:17;;:20::21;;:16:::1;4:12:4:13:0;;:16::17;;:12:::1;5::5:13:0;;:17::18;;:21::22;:17:::1;:12;:24:9:9:0;6:20:6:21;;:24::25;;:20:::1;7:16:7:17:0;;:20::21;;:16:::1;:12::22:0;;;;8:20:8:21;;:24::25;;:20:::1;:12::27;5:24:9:9;9:15:11::0;10:20:10:21;;:25::26;;:20:::1;:12::28;9:15:11:9;12:12:12:13:0;;:16::17;;:12:::1;13:16:13::0;;:21::22;;:16:::1;2:4:14:5;;',
sourceMap: '3:16:3:17;;:20::21;;:16:::1;4:12:4:13:0;;:16::17;;:12:::1;5::5:13:0;;:17::18;;:21::22;:17:::1;:12;:24:9:9:0;6:20:6:21;;:24::25;;:20:::1;7:16:7:17:0;;:20::21;;:16:::1;:12::22;;;;8:20:8:21:0;;:24::25;;:20:::1;:12::27;5:24:9:9;9:15:11::0;10:20:10:21;;:25::26;;:20:::1;:12::28;9:15:11:9;12:12:12:13:0;;:16::17;;:12:::1;13:16:13::0;;:21::22;;:16:::1;2:4:14:5;;',
},
source: fs.readFileSync(new URL('../valid-contract-files/if_statement.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -225,7 +225,7 @@ export const fixtures: Fixture[] = [
{ ip: 104, line: 22 },
{ ip: 114, line: 25 },
],
sourceMap: '2:4:14:5;;;;;3:16:3:17;;:20::21;;:16:::1;4:12:4:13:0;;:16::17;;:12:::1;5::5:13:0;;:17::18;;:12:::1;:20:9:9:0;6::6:21;;:24::25;;:20:::1;7:16:7:17:0;;:20::21;;:16:::1;:12::22:0;;;;8:20:8:21;;:24::25;;:20:::1;:12::27;5:20:9:9;9:15:11::0;10:16:10:17;;:12::18;;;9:15:11:9:1;12:12:12:13:0;;:16::17;;:12:::1;13:16:13::0;;:21::22;;:16:::1;:8::24;2:4:14:5;;;;;;16::26::0;;;;;17:16:17:17;;18:12:18:13;;:16::17;:12:::1;19::19:13:0;;:17::18;;:12:::1;:20:23:9:0;20::20:21;;:24::25;;:20:::1;21:16:21:17:0;;:20::21;;:16:::1;:12::22:0;;;;22:20:22:21;;:24::25;;:20:::1;:12::27;19:20:23:9;;24:12:24:13:0;;25:16:25:17;;:21::22;;:16:::1;16:4:26:5;;1:0:27:1',
sourceMap: '2:4:14:5;;;;;3:16:3:17;;:20::21;;:16:::1;4:12:4:13:0;;:16::17;;:12:::1;5::5:13:0;;:17::18;;:12:::1;:20:9:9:0;6::6:21;;:24::25;;:20:::1;7:16:7:17:0;;:20::21;;:16:::1;:12::22;;;;8:20:8:21:0;;:24::25;;:20:::1;:12::27;5:20:9:9;9:15:11::0;10:16:10:17;;:12::18:1;;;9:15:11:9;12:12:12:13:0;;:16::17;;:12:::1;13:16:13::0;;:21::22;;:16:::1;:8::24;2:4:14:5;;;;;;16::26::0;;;;;17:16:17:17;;18:12:18:13;;:16::17;:12:::1;19::19:13:0;;:17::18;;:12:::1;:20:23:9:0;20::20:21;;:24::25;;:20:::1;21:16:21:17:0;;:20::21;;:16:::1;:12::22;;;;22:20:22:21:0;;:24::25;;:20:::1;:12::27;19:20:23:9;;24:12:24:13:0;;25:16:25:17;;:21::22;;:16:::1;16:4:26:5;;1:0:27:1',
},
source: fs.readFileSync(new URL('../valid-contract-files/multifunction_if_statements.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -278,7 +278,7 @@ export const fixtures: Fixture[] = [
{ ip: 17, line: 4 },
{ ip: 27, line: 5 },
],
sourceMap: '3:18:3:19;;:26::27;;:::34;;:37::38;:26:::1;:18::39;:::42;4:16:4:17:0;;:21::22;;:16:::1;;:8::24;5:16:5:17:0;;:24::25;:16::26:1;:::29;:33::34:0;;:16:::1;',
sourceMap: '3:18:3:19;;:26::27;;:::34:1;;:37::38:0;:26:::1;:18::39;:::42;4:16:4:17:0;;:21::22;;:16:::1;;:8::24;5:16:5:17:0;;:24::25;:16::26:1;:::29;:33::34:0;;:16:::1;',
},
source: fs.readFileSync(new URL('../valid-contract-files/split_size.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -306,7 +306,7 @@ export const fixtures: Fixture[] = [
{ ip: 9, line: 3 },
{ ip: 15, line: 4 },
],
sourceMap: '3:33:3:35;;:17::37:1;:49::51:0;:41::52:1;:17;:57::61:0;:56;:17:::1;:8::64;4:25:4:26:0;;:28::30;;:16::31:1',
sourceMap: '3:33:3:35;;:17::37:1;:49::51:0;:41::52:1;:17;:57::61:0;:56:::1;:17;:8::64;4:25:4:26:0;;:28::30;;:16::31:1',
},
source: fs.readFileSync(new URL('../valid-contract-files/cast_hash_checksig.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -395,7 +395,7 @@ export const fixtures: Fixture[] = [
bytecode: '5152535455565579539f6353567a757c6b7c6b7c6b7c6b7c6c6c6c6c68557a557a557a93547a93537a93527a93a0',
logs: [],
requires: [{ ip: 46, line: 14 }],
sourceMap: '3:16:3:17;4::4;5::5;6::6;7::7;8::8;10:12:10:13;;:16::17;:12:::1;:19:12:9:0;11:16:11:17;:12::18;;;;;;;;;;;;;;;;10:19:12:9:1;14:16:14:17:0;;:20::21;;:24::25;;:20:::1;:28::29:0;;:20:::1;:32::33:0;;:20:::1;:36::37:0;;:20:::1;:16',
sourceMap: '3:16:3:17;4::4;5::5;6::6;7::7;8::8;10:12:10:13;;:16::17;:12:::1;:19:12:9:0;11:16:11:17;:12::18:1;;;;;;;;;;;;;;;;10:19:12:9;14:16:14:17:0;;:20::21;;:24::25;;:20:::1;:28::29:0;;:20:::1;:32::33:0;;:20:::1;:36::37:0;;:20:::1;:16',
},
source: fs.readFileSync(new URL('../valid-contract-files/deep_replace.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -531,7 +531,7 @@ export const fixtures: Fixture[] = [
{ ip: 96, line: 21 },
{ ip: 101, line: 22 },
],
sourceMap: '3:16:3:26;:30::31;:16:::1;:8::33;4:16:4:27:0;:31::32;:16:::1;:8::34;5:16:5:32:0;:36::37;:16:::1;:8::39;6:16:6:33:0;:37::38;:16:::1;:8::40;7:16:7:37:0;:41::42;:16:::1;:8::44;8:16:8:35:0;:::42;;:46::49;:16:::1;:8::51;9:26:9:27:0;:16::34;:38::43;:16:::1;:8::45;10:26:10:27:0;:16::44;:::51;;:55::60;:16:::1;:8::62;11:26:11:27:0;:16::52;:56::121;:16:::1;:8::123;12:26:12:27:0;:16::42;:46::47;:16:::1;:8::49;13:26:13:27:0;:16::46;:::53;;:57::60;:16:::1;:8::62;14:26:14:27:0;:16::43;:47::48;:16:::1;:8::50;15:27:15:28:0;:16::35;:39::44;:16:::1;:8::46;16:27:16:28:0;:16::45;:::52;;:56::59;:16:::1;:8::61;17:26:17:27:0;:16::42;:46::111;:16:::1;:8::113;18:26:18:27:0;:16::42;:46::50;:16:::1;:8::52;19:26:19:27:0;:16::40;:44::47;:16:::1;:8::49;20:27:20:28:0;:16::43;:47::112;:16:::1;:8::114;21:27:21:28:0;:16::43;:47::51;:16:::1;:8::53;22:27:22:28:0;:16::41;:45::48;:16:::1',
sourceMap: '3:16:3:26;:30::31;:16:::1;:8::33;4:16:4:27:0;:31::32;:16:::1;:8::34;5:16:5:32:0;:36::37;:16:::1;:8::39;6:16:6:33:0;:37::38;:16:::1;:8::40;7:16:7:37:0;:41::42;:16:::1;:8::44;8:16:8:35:0;:::42:1;;:46::49:0;:16:::1;:8::51;9:26:9:27:0;:16::34:1;:38::43:0;:16:::1;:8::45;10:26:10:27:0;:16::44:1;:::51;;:55::60:0;:16:::1;:8::62;11:26:11:27:0;:16::52:1;:56::121:0;:16:::1;:8::123;12:26:12:27:0;:16::42:1;:46::47:0;:16:::1;:8::49;13:26:13:27:0;:16::46:1;:::53;;:57::60:0;:16:::1;:8::62;14:26:14:27:0;:16::43:1;:47::48:0;:16:::1;:8::50;15:27:15:28:0;:16::35:1;:39::44:0;:16:::1;:8::46;16:27:16:28:0;:16::45:1;:::52;;:56::59:0;:16:::1;:8::61;17:26:17:27:0;:16::42:1;:46::111:0;:16:::1;:8::113;18:26:18:27:0;:16::42:1;:46::50:0;:16:::1;:8::52;19:26:19:27:0;:16::40:1;:44::47:0;:16:::1;:8::49;20:27:20:28:0;:16::43:1;:47::112:0;:16:::1;:8::114;21:27:21:28:0;:16::43:1;:47::51:0;:16:::1;:8::53;22:27:22:28:0;:16::41:1;:45::48:0;:16:::1',
},
source: fs.readFileSync(new URL('../valid-contract-files/covenant_all_fields.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -605,7 +605,7 @@ export const fixtures: Fixture[] = [
{ ip: 91, line: 24 },
{ ip: 97, line: 25 },
],
sourceMap: '2:4:21:5;;;;;3:26:3:32;;:8::34:1;;6:27:6:28:0;:16::45;:49::84;:74::83;;:49::84;;;:16:::1;:8::86;8:23:8:27:0;9:37:9:58;:27::65;10:26:10:38;;:41::47;;:26:::1;:50::58:0;;:26:::1;14:12:14:23:0;;:27::33;;:36::44;;:27:::1;:12;:46:16:9:0;15:31:15:32;:20::39;:43::55;;:58::66;;:43:::1;:20;:12::68;16:15:20:9:0;17:31:17:32;:20::39;:43::49;;:20:::1;:12::51;18:31:18:32:0;:20::49;:63::84;:53::101;:20:::1;:12::103;19:31:19:32:0;:20::39;:43::54;;:20:::1;:12::56;16:15:20:9;2:4:21:5;;;;;;;;23::26::0;;;;;24:24:24:26;;:16::27:1;:31::37:0;;:16:::1;:8::39;25:25:25:26:0;;:28::30;;:16::31:1;23:4:26:5;;;1:0:27:1',
sourceMap: '2:4:21:5;;;;;3:26:3:32;;:8::34:1;;6:27:6:28:0;:16::45:1;:49::84:0;:74::83;;:49::84:1;;;:16;:8::86;8:23:8:27:0;9:37:9:58;:27::65:1;10:26:10:38:0;;:41::47;;:26:::1;:50::58:0;;:26:::1;14:12:14:23:0;;:27::33;;:36::44;;:27:::1;:12;:46:16:9:0;15:31:15:32;:20::39:1;:43::55:0;;:58::66;;:43:::1;:20;:12::68;16:15:20:9:0;17:31:17:32;:20::39:1;:43::49:0;;:20:::1;:12::51;18:31:18:32:0;:20::49:1;:63::84:0;:53::101:1;:20;:12::103;19:31:19:32:0;:20::39:1;:43::54:0;;:20:::1;:12::56;16:15:20:9;2:4:21:5;;;;;;;;23::26::0;;;;;24:24:24:26;;:16::27:1;:31::37:0;;:16:::1;:8::39;25:25:25:26:0;;:28::30;;:16::31:1;23:4:26:5;;;1:0:27:1',
},
source: fs.readFileSync(new URL('../valid-contract-files/mecenas.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down Expand Up @@ -655,7 +655,7 @@ export const fixtures: Fixture[] = [
{ ip: 47, line: 24 },
{ ip: 53, line: 25 },
],
sourceMap: '10:29:13:10;11:12:11:18;;;;;12:18:12:118;:12::119;;;;;;;;;;;;16:27:16:28;:16::35;:39::40;:16:::1;:8::42;17:27:17:28:0;:16::45;:49::61;;:16:::1;:8::63;21:23:21:27:0;22:37:22:58;:27::65;:68::76;;:27:::1;23:12:23:24:0;;:28::36;;:12:::1;:38:26:9:0;24:31:24:32;:20::49;:63::84;:53::101;:20:::1;:12::103;25:31:25:32:0;:20::39;:43::55;;:20:::1;:12::57;23:38:26:9;8:4:27:5;',
sourceMap: '10:29:13:10;11:12:11:18;::::1;;;;12:18:12:118:0;:12::119:1;;;;;;;;;;;;16:27:16:28:0;:16::35:1;:39::40:0;:16:::1;:8::42;17:27:17:28:0;:16::45:1;:49::61:0;;:16:::1;:8::63;21:23:21:27:0;22:37:22:58;:27::65:1;:68::76:0;;:27:::1;23:12:23:24:0;;:28::36;;:12:::1;:38:26:9:0;24:31:24:32;:20::49:1;:63::84:0;:53::101:1;:20;:12::103;25:31:25:32:0;:20::39:1;:43::55:0;;:20:::1;:12::57;23:38:26:9;8:4:27:5;',
},
source: fs.readFileSync(new URL('../valid-contract-files/announcement.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand All @@ -678,7 +678,7 @@ export const fixtures: Fixture[] = [
bytecode: '0079bc517a87',
logs: [],
requires: [{ ip: 6, line: 3 }],
sourceMap: '3:16:3:26;;:::36;:40::50;;:16:::1',
sourceMap: '3:16:3:26;;:::36:1;:40::50:0;;:16:::1',
},
source: fs.readFileSync(new URL('../valid-contract-files/p2palindrome.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand All @@ -701,7 +701,7 @@ export const fixtures: Fixture[] = [
bytecode: '5a517a80007a815a9c',
logs: [],
requires: [{ ip: 9, line: 4 }],
sourceMap: '3:28:3:30;:32::36;;:22::37;4:20:4:25;;:16::26:1;:30::32:0;:16:::1',
sourceMap: '3:28:3:30;:32::36;;:22::37:1;4:20:4:25:0;;:16::26:1;:30::32:0;:16:::1',
},
source: fs.readFileSync(new URL('../valid-contract-files/num2bin_variable.cash', import.meta.url), { encoding: 'utf-8' }),
compiler: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export const fixtures: Fixture[] = [
's': {
'description': '"s" parameter of function "spend"',
'name': 's',
'type': 'Key',
'type': 'WalletData',
},
'pk': {
'description': '"pk" parameter of function "spend"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ describe('Libauth Template generation tests', () => {
fixtures.forEach((fixture) => {
it(`should generate a valid libauth template for ${fixture.name}`, async () => {
const generatedTemplate = await fixture.transaction.getLibauthTemplate();
console.log(JSON.stringify(generatedTemplate, null, 2));
console.log(await fixture.transaction.bitauthUri());
// console.log(JSON.stringify(generatedTemplate, null, 2));
// console.log(await fixture.transaction.bitauthUri());
expect(generatedTemplate).toEqual(fixture.template);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/test/fixtures/bitauth-script.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ contract Mecenas(bytes20 recipient, bytes20 funder, int pledge/*, int period */)
}
}`.replace(/^\n+/, '').replace(/\n+$/, ''),
asmBytecode: 'OP_3 OP_PICK OP_0 OP_NUMEQUAL OP_IF OP_0 OP_OUTPUTBYTECODE 76a914 OP_2 OP_ROLL OP_CAT 88ac OP_CAT OP_EQUAL OP_VERIFY e803 OP_INPUTINDEX OP_UTXOVALUE OP_0 OP_PICK OP_4 OP_PICK OP_SUB OP_2 OP_PICK OP_SUB OP_0 OP_PICK OP_5 OP_PICK OP_4 OP_PICK OP_ADD OP_LESSTHANOREQUAL OP_IF OP_0 OP_OUTPUTVALUE OP_2 OP_PICK OP_4 OP_PICK OP_SUB OP_NUMEQUAL OP_VERIFY OP_ELSE OP_0 OP_OUTPUTVALUE OP_5 OP_PICK OP_NUMEQUAL OP_VERIFY OP_1 OP_OUTPUTBYTECODE OP_INPUTINDEX OP_UTXOBYTECODE OP_EQUAL OP_VERIFY OP_1 OP_OUTPUTVALUE OP_1 OP_PICK OP_NUMEQUAL OP_VERIFY OP_ENDIF OP_1 OP_NIP OP_NIP OP_NIP OP_NIP OP_NIP OP_NIP OP_ELSE OP_3 OP_ROLL OP_1 OP_NUMEQUAL OP_VERIFY OP_3 OP_PICK OP_HASH160 OP_2 OP_ROLL OP_EQUAL OP_VERIFY OP_3 OP_ROLL OP_3 OP_ROLL OP_CHECKSIG OP_NIP OP_NIP OP_ENDIF',
sourceMap: '9:4:28:5;;;;;13:27:13:28;:16::45;:49::84;:74::83;;:49::84;;;:16:::1;:8::86;15:23:15:27:0;16:37:16:58;:27::65;17:26:17:38;;:41::47;;:26:::1;:50::58:0;;:26:::1;21:12:21:23:0;;:27::33;;:36::44;;:27:::1;:12;:46:23:9:0;22:31:22:32;:20::39;:43::55;;:58::66;;:43:::1;:20;:12::68;23:15:27:9:0;24:31:24:32;:20::39;:43::49;;:20:::1;:12::51;25:31:25:32:0;:20::49;:63::84;:53::101;:20:::1;:12::103;26:31:26:32:0;:20::39;:43::54;;:20:::1;:12::56;23:15:27:9;9:4:28:5;;;;;;;;30::33::0;;;;;31:24:31:26;;:16::27:1;:31::37:0;;:16:::1;:8::39;32:25:32:26:0;;:28::30;;:16::31:1;30:4:33:5;;8:0:34:1',
sourceMap: '9:4:28:5;;;;;13:27:13:28;:16::45:1;:49::84:0;:74::83;;:49::84:1;;;:16;:8::86;15:23:15:27:0;16:37:16:58;:27::65:1;17:26:17:38:0;;:41::47;;:26:::1;:50::58:0;;:26:::1;21:12:21:23:0;;:27::33;;:36::44;;:27:::1;:12;:46:23:9:0;22:31:22:32;:20::39:1;:43::55:0;;:58::66;;:43:::1;:20;:12::68;23:15:27:9:0;24:31:24:32;:20::39:1;:43::49:0;;:20:::1;:12::51;25:31:25:32:0;:20::49:1;:63::84:0;:53::101:1;:20;:12::103;26:31:26:32:0;:20::39:1;:43::54:0;;:20:::1;:12::56;23:15:27:9;9:4:28:5;;;;;;;;30::33::0;;;;;31:24:31:26;;:16::27:1;:31::37:0;;:16:::1;:8::39;32:25:32:26:0;;:28::30;;:16::31:1;30:4:33:5;;8:0:34:1',
expectedLineToOpcodeMap: {
9: [Op.OP_3, Op.OP_PICK, new Uint8Array([]), Op.OP_NUMEQUAL, Op.OP_IF],
13: [new Uint8Array([]), Op.OP_OUTPUTBYTECODE, hexToBin('76a914'), Op.OP_2, Op.OP_ROLL, Op.OP_CAT, hexToBin('88ac'), Op.OP_CAT, Op.OP_EQUAL, Op.OP_VERIFY],
Expand Down

0 comments on commit cd3031b

Please sign in to comment.