Skip to content

Commit 78f7bf5

Browse files
unable all tests of snak-test
1 parent c77f7d3 commit 78f7bf5

File tree

1 file changed

+104
-58
lines changed

1 file changed

+104
-58
lines changed

packages/agents/__tests__/code-quality/snak.test.ts

Lines changed: 104 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -208,64 +208,110 @@ describe('Code Generation and Compilation Tests', () => {
208208
expect(result.success).toBe(true);
209209
}, 100000);
210210

211-
// test('Max value in array', async () => {
212-
// const project_name = 'max_value';
213-
// const prompt_content = "a Cairo function that finds the maximum value in an array";
214-
// const success = await generateAndCompile(project_name, prompt_content, 2);
215-
// expect(success).toBe(true);
216-
// }, 100000);
217-
218-
// test('Simple sorting algorithm', async () => {
219-
// const project_name = 'sorting';
220-
// const prompt_content = "a sorting algorithm";
221-
// const success = await generateAndCompile(project_name, prompt_content, 3);
222-
// expect(success).toBe(true);
223-
// }, 100000);
211+
test('Max value in array', async () => {
212+
const project_name = 'max_value';
213+
const prompt_content =
214+
'a Cairo function that finds the maximum value in an array';
215+
const result = await generateAndCompile(project_name, prompt_content, 2);
216+
217+
if (!result.success) {
218+
console.error(`❌ TEST FAILED: ${result.error}`);
219+
}
220+
221+
expect(result.success).toBe(true);
222+
}, 100000);
223+
224+
test('Simple sorting algorithm', async () => {
225+
const project_name = 'sorting';
226+
const prompt_content = 'a sorting algorithm';
227+
const result = await generateAndCompile(project_name, prompt_content, 3);
228+
229+
if (!result.success) {
230+
console.error(`❌ TEST FAILED: ${result.error}`);
231+
}
232+
233+
expect(result.success).toBe(true);
234+
}, 100000);
235+
});
236+
237+
describe('Simple Starknet Contracts', () => {
238+
test('Basic contract with storage', async () => {
239+
const project_name = 'basic_contract';
240+
const prompt_content =
241+
'a basic Starknet contract with a storage variable and getter/setter functions';
242+
const result = await generateAndCompile(project_name, prompt_content, 4);
243+
244+
if (!result.success) {
245+
console.error(`❌ TEST FAILED: ${result.error}`);
246+
}
247+
248+
expect(result.success).toBe(true);
249+
}, 100000);
250+
251+
test('Counter contract', async () => {
252+
const project_name = 'counter';
253+
const prompt_content =
254+
'a Starknet contract that maintains a counter with increment and decrement functions';
255+
const result = await generateAndCompile(project_name, prompt_content, 5);
256+
257+
if (!result.success) {
258+
console.error(`❌ TEST FAILED: ${result.error}`);
259+
}
260+
261+
expect(result.success).toBe(true);
262+
}, 100000);
263+
264+
test('Simple voting system', async () => {
265+
const project_name = 'voting';
266+
const prompt_content =
267+
'a Starknet contract for a simple voting system where users can vote only once';
268+
const result = await generateAndCompile(project_name, prompt_content, 6);
269+
270+
if (!result.success) {
271+
console.error(`❌ TEST FAILED: ${result.error}`);
272+
}
273+
274+
expect(result.success).toBe(true);
275+
}, 100000);
224276
});
225277

226-
// describe('Simple Starknet Contracts', () => {
227-
// test('Basic contract with storage', async () => {
228-
// const project_name = 'basic_contract';
229-
// const prompt_content = "a basic Starknet contract with a storage variable and getter/setter functions";
230-
// const success = await generateAndCompile(project_name, prompt_content, 4);
231-
// expect(success).toBe(true);
232-
// }, 100000);
233-
234-
// test('Counter contract', async () => {
235-
// const project_name = 'counter';
236-
// const prompt_content = "a Starknet contract that maintains a counter with increment and decrement functions";
237-
// const success = await generateAndCompile(project_name, prompt_content, 5);
238-
// expect(success).toBe(true);
239-
// }, 100000);
240-
241-
// test('Simple voting system', async () => {
242-
// const project_name = 'voting';
243-
// const prompt_content = "a Starknet contract for a simple voting system where users can vote only once";
244-
// const success = await generateAndCompile(project_name, prompt_content, 6);
245-
// expect(success).toBe(true);
246-
// }, 100000);
247-
// });
248-
249-
// describe('Standard and Complex Contracts', () => {
250-
// test('ERC-20 token contract', async () => {
251-
// const project_name = 'erc20';
252-
// const prompt_content = "a minimal Starknet ERC-20 token contract";
253-
// const success = await generateAndCompile(project_name, prompt_content, 7);
254-
// expect(success).toBe(true);
255-
// }, 100000);
256-
257-
// test('ERC-721 NFT contract', async () => {
258-
// const project_name = 'erc721';
259-
// const prompt_content = "a Starknet ERC-721 NFT contract with minting functionality";
260-
// const success = await generateAndCompile(project_name, prompt_content, 8);
261-
// expect(success).toBe(true);
262-
// }, 100000);
263-
264-
// test('Multisig wallet contract', async () => {
265-
// const project_name = 'multisig';
266-
// const prompt_content = "a Starknet multisig wallet contract that requires multiple approvals for transactions";
267-
// const success = await generateAndCompile(project_name, prompt_content, 9);
268-
// expect(success).toBe(true);
269-
// }, 100000);
270-
// });
278+
describe('Standard and Complex Contracts', () => {
279+
test('ERC-20 token contract', async () => {
280+
const project_name = 'erc20';
281+
const prompt_content = 'a minimal Starknet ERC-20 token contract';
282+
const result = await generateAndCompile(project_name, prompt_content, 7);
283+
284+
if (!result.success) {
285+
console.error(`❌ TEST FAILED: ${result.error}`);
286+
}
287+
288+
expect(result.success).toBe(true);
289+
}, 100000);
290+
291+
test('ERC-721 NFT contract', async () => {
292+
const project_name = 'erc721';
293+
const prompt_content =
294+
'a Starknet ERC-721 NFT contract with minting functionality';
295+
const result = await generateAndCompile(project_name, prompt_content, 8);
296+
297+
if (!result.success) {
298+
console.error(`❌ TEST FAILED: ${result.error}`);
299+
}
300+
301+
expect(result.success).toBe(true);
302+
}, 100000);
303+
304+
test('Multisig wallet contract', async () => {
305+
const project_name = 'multisig';
306+
const prompt_content =
307+
'a Starknet multisig wallet contract that requires multiple approvals for transactions';
308+
const result = await generateAndCompile(project_name, prompt_content, 9);
309+
310+
if (!result.success) {
311+
console.error(`❌ TEST FAILED: ${result.error}`);
312+
}
313+
314+
expect(result.success).toBe(true);
315+
}, 100000);
316+
});
271317
});

0 commit comments

Comments
 (0)