code wiki / _hdl_build / nx_profile_contract_gate_t239.nx
nx_profile_contract_gate_t239.nx source
↩ module page · 20 lines · 1079 B
1import "nx_syscalls.nx"
2import "nx_profile_contract.nx"
3func check(s:*u8,expect:i64)->i64{var n:i64=0;while s[n]!=(0 as u8){n=n+1}let info:*i64=sys_mmap(40) as *i64;return profile_contract_scan(s,n,info)==expect}
4func main(argc:i64,argv:*i64)->i64{
5 if check("V 2\nN 48\n" as *u8,0)==0{return 1}
6 if check("V 2\nQ 816 0 1 1 1 674\n" as *u8,1)==0{return 2}
7 if check("N 48\n" as *u8,0-2)==0{return 3}
8 if check("V 3\n" as *u8,0-1)==0{return 4}
9 if check("V 2\nQ 816 0 1 1 1\n" as *u8,0-1)==0{return 5}
10 if check("V 2\nQ 816 0 1 2 1 674\n" as *u8,0-1)==0{return 6}
11 if check("Q 816 0 1 1 1 674\n" as *u8,0-1)==0{return 7}
12 if check("V 2\nV 2\n" as *u8,0-1)==0{return 8}
13 if check("V 2\nQ 9223372036854775808 0 1 1 1 674\n" as *u8,0-1)==0{return 9}
14 if check("V 2\nQ -1 0 1 1 1 674\n" as *u8,0-1)==0{return 10}
15 if argc>1{let len:*i64=sys_mmap(16) as *i64;let b:*u8=sys_read_file(argv[1] as *u8,len);if (b as i64)==0{return 11}
16 let info:*i64=sys_mmap(40) as *i64;let verdict:i64=profile_contract_scan(b,len[0],info)
17 if verdict!=1{return 12}if info[1]<=0{return 13}
18 }
19 return 0
20}