fix core tests
This commit is contained in:
parent
aad6622488
commit
d8d082b649
9 changed files with 34 additions and 34 deletions
|
@ -1,8 +1,8 @@
|
||||||
import "utils/casts/u32_to_field" as to_field
|
import "utils/casts/u32_to_field" as to_field
|
||||||
|
|
||||||
def main(field x) -> field:
|
def main(field x) -> field:
|
||||||
field f = 1
|
field mut f = 1
|
||||||
field counter = 0
|
field mut counter = 0
|
||||||
for u32 i in 1..5 do
|
for u32 i in 1..5 do
|
||||||
f = if counter == x then f else f * to_field(i) fi
|
f = if counter == x then f else f * to_field(i) fi
|
||||||
counter = if counter == x then counter else counter + 1 fi
|
counter = if counter == x then counter else counter + 1 fi
|
||||||
|
|
|
@ -2,7 +2,7 @@ def foo(field[1] a) -> field:
|
||||||
return a[0]
|
return a[0]
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
field[1] a = [1]
|
field[1] mut a = [1]
|
||||||
field b = foo(a)
|
field b = foo(a)
|
||||||
a[0] = 0
|
a[0] = 0
|
||||||
field c = foo(a)
|
field c = foo(a)
|
||||||
|
|
|
@ -5,9 +5,9 @@ from "field" import FIELD_MAX, FIELD_SIZE_IN_BITS
|
||||||
// this comparison works for any N smaller than the field size, which is the case in practice
|
// this comparison works for any N smaller than the field size, which is the case in practice
|
||||||
def le<N>(bool[N] a_bits, bool[N] c_bits) -> bool:
|
def le<N>(bool[N] a_bits, bool[N] c_bits) -> bool:
|
||||||
|
|
||||||
bool size_unknown = false
|
bool mut size_unknown = false
|
||||||
|
|
||||||
u32 verified_conditions = 0 // `and(conditions) == (sum(conditions) == len(conditions))`, here we initialize `sum(conditions)`
|
u32 mut verified_conditions = 0 // `and(conditions) == (sum(conditions) == len(conditions))`, here we initialize `sum(conditions)`
|
||||||
|
|
||||||
size_unknown = true
|
size_unknown = true
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
def main(field[4] values) -> (field, field, field):
|
def main(field[4] values) -> (field, field, field):
|
||||||
field res0 = 1
|
field mut res0 = 1
|
||||||
field res1 = 0
|
field mut res1 = 0
|
||||||
|
|
||||||
u32 counter = 0
|
u32 mut counter = 0
|
||||||
|
|
||||||
for u32 i in 0..4 do
|
for u32 i in 0..4 do
|
||||||
for u32 j in i..4 do
|
for u32 j in i..4 do
|
||||||
|
@ -15,9 +15,9 @@ def main(field[4] values) -> (field, field, field):
|
||||||
res1 = res1 + 1
|
res1 = res1 + 1
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
field res2 = 0
|
field mut res2 = 0
|
||||||
u32 i = 0
|
u32 mut i = 0
|
||||||
for u32 i in i..5 do
|
for u32 mut i in i..5 do
|
||||||
i = 5
|
i = 5
|
||||||
for u32 i in 0..i do
|
for u32 i in 0..i do
|
||||||
res2 = res2 + 1
|
res2 = res2 + 1
|
||||||
|
|
|
@ -2,15 +2,15 @@ struct Foo {
|
||||||
field a
|
field a
|
||||||
}
|
}
|
||||||
|
|
||||||
def mutate(field a) -> field:
|
def mutate(field mut a) -> field:
|
||||||
a = a + 1
|
a = a + 1
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def mutate(Foo f) -> Foo:
|
def mutate(Foo mut f) -> Foo:
|
||||||
f.a = f.a + 1
|
f.a = f.a + 1
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def mutate(field[1] f) -> field[1]:
|
def mutate(field[1] mut f) -> field[1]:
|
||||||
f[0] = f[0] + 1
|
f[0] = f[0] + 1
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@ struct State {
|
||||||
}
|
}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
State s = State { memory: [0; 16] }
|
State mut s = State { memory: [0; 16] }
|
||||||
s.memory[0] = 0x00000001
|
s.memory[0] = 0x00000001
|
||||||
return
|
return
|
|
@ -1,4 +1,4 @@
|
||||||
def main():
|
def main():
|
||||||
(u32[16],) s = ([0; 16],)
|
(u32[16],) mut s = ([0; 16],)
|
||||||
s.0[0] = 0x00000001
|
s.0[0] = 0x00000001
|
||||||
return
|
return
|
|
@ -1,6 +1,6 @@
|
||||||
// 32 constraints for input constraining
|
// 32 constraints for input constraining
|
||||||
def main(u32 a) -> u32:
|
def main(u32 a) -> u32:
|
||||||
u32 res = 0x00000000
|
u32 mut res = 0x00000000
|
||||||
for u32 i in 0..10 do
|
for u32 i in 0..10 do
|
||||||
res = res + a
|
res = res + a
|
||||||
endfor
|
endfor
|
||||||
|
|
|
@ -28,14 +28,14 @@ def temp2(u32 a, u32 b, u32 c) -> u32:
|
||||||
|
|
||||||
def main(u32[1][16] input) -> u32[8]:
|
def main(u32[1][16] input) -> u32[8]:
|
||||||
|
|
||||||
u32 h0 = 0x6a09e667
|
u32 mut h0 = 0x6a09e667
|
||||||
u32 h1 = 0xbb67ae85
|
u32 mut h1 = 0xbb67ae85
|
||||||
u32 h2 = 0x3c6ef372
|
u32 mut h2 = 0x3c6ef372
|
||||||
u32 h3 = 0xa54ff53a
|
u32 mut h3 = 0xa54ff53a
|
||||||
u32 h4 = 0x510e527f
|
u32 mut h4 = 0x510e527f
|
||||||
u32 h5 = 0x9b05688c
|
u32 mut h5 = 0x9b05688c
|
||||||
u32 h6 = 0x1f83d9ab
|
u32 mut h6 = 0x1f83d9ab
|
||||||
u32 h7 = 0x5be0cd19
|
u32 mut h7 = 0x5be0cd19
|
||||||
|
|
||||||
u32[64] k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]
|
u32[64] k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]
|
||||||
|
|
||||||
|
@ -44,21 +44,21 @@ def main(u32[1][16] input) -> u32[8]:
|
||||||
|
|
||||||
for u32 i in 0..1 do
|
for u32 i in 0..1 do
|
||||||
|
|
||||||
u32[64] w = [...input[0], ...[0x00000000; 48]]
|
u32[64] mut w = [...input[0], ...[0x00000000; 48]]
|
||||||
|
|
||||||
for u32 i in 16..64 do
|
for u32 i in 16..64 do
|
||||||
u32 r = extend(w, i)
|
u32 r = extend(w, i)
|
||||||
w[i] = r
|
w[i] = r
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
u32 a = h0
|
u32 mut a = h0
|
||||||
u32 b = h1
|
u32 mut b = h1
|
||||||
u32 c = h2
|
u32 mut c = h2
|
||||||
u32 d = h3
|
u32 mut d = h3
|
||||||
u32 e = h4
|
u32 mut e = h4
|
||||||
u32 f = h5
|
u32 mut f = h5
|
||||||
u32 g = h6
|
u32 mut g = h6
|
||||||
u32 h = h7
|
u32 mut h = h7
|
||||||
|
|
||||||
for u32 i in 0..64 do
|
for u32 i in 0..64 do
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue