Skip to content

Commit

Permalink
refactor: use array_append to test Cairo program parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalatrax committed Aug 7, 2024
1 parent e3628bb commit 91c0ab5
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/vm/program.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as fs from 'fs';

import { Felt } from 'primitives/felt';

import { OpType } from 'hints/hintParamsSchema';
import { Hint } from 'hints/hintSchema';
import { HintName } from 'hints/hintName';
import { Register } from './instruction';
Expand All @@ -27,10 +26,10 @@ describe('program', () => {
});
});

describe('parseCairo1Program', () => {
describe('parseCairoProgram', () => {
test('should correctly parse the program', () => {
const programContent = fs.readFileSync(
'cairo_programs/cairo/hints/test_less_than_true.json',
'cairo_programs/cairo/hints/array_append.json',
'utf8'
);
const programJson = JSON.parse(programContent);
Expand All @@ -39,24 +38,10 @@ describe('program', () => {
});

const hints = new Map<number, Hint[]>();
hints.set(5, [
hints.set(0, [
{
type: HintName.TestLessThan,
lhs: {
type: OpType.Deref,
cell: {
register: Register.Ap,
offset: 0,
},
},
rhs: {
type: OpType.Immediate,
value: new Felt(BigInt('0x100000000')),
},
dst: {
register: Register.Ap,
offset: -1,
},
type: HintName.AllocSegment,
dst: { register: Register.Ap, offset: 0 },
},
]);

Expand Down

0 comments on commit 91c0ab5

Please sign in to comment.