add add test
This commit is contained in:
parent
ca53a928ee
commit
6b988c1dae
6 changed files with 56 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/uint/add.zok",
|
||||
"constraint_count": 29,
|
||||
"constraint_count": 102,
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
def main(u8 a, u8 b) -> (u8):
|
||||
return a + b
|
||||
def main(u32 a, u32 d) -> (u32):
|
||||
u32 b = 0x12345678
|
||||
u32 c = 0x01234567
|
||||
return (a ^ b) + c + d
|
16
zokrates_core_test/tests/tests/uint/ch.json
Normal file
16
zokrates_core_test/tests/tests/uint/ch.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/uint/ch.zok",
|
||||
"constraint_count": 200,
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": ["0", "0", "0"]
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["0"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
2
zokrates_core_test/tests/tests/uint/ch.zok
Normal file
2
zokrates_core_test/tests/tests/uint/ch.zok
Normal file
|
@ -0,0 +1,2 @@
|
|||
def main(u32 e, u32 f, u32 g) -> (u32):
|
||||
return (e + f) ^ (!e + g)
|
16
zokrates_core_test/tests/tests/uint/rotate.json
Normal file
16
zokrates_core_test/tests/tests/uint/rotate.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/uint/rotate.zok",
|
||||
"constraint_count": 98,
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": ["0"]
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["0"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
17
zokrates_core_test/tests/tests/uint/rotate.zok
Normal file
17
zokrates_core_test/tests/tests/uint/rotate.zok
Normal file
|
@ -0,0 +1,17 @@
|
|||
import "EMBED/u32_to_bits" as to_bits
|
||||
import "EMBED/u32_from_bits" as from_bits
|
||||
|
||||
def right_rotate_6(u32 e) -> (u32):
|
||||
bool[32] b = to_bits(e)
|
||||
return from_bits([...b[6..], ...b[..6]])
|
||||
|
||||
def right_rotate_11(u32 e) -> (u32):
|
||||
bool[32] b = to_bits(e)
|
||||
return from_bits([...b[11..], ...b[..11]])
|
||||
|
||||
def right_rotate_25(u32 e) -> (u32):
|
||||
bool[32] b = to_bits(e)
|
||||
return from_bits([...b[25..], ...b[..25]])
|
||||
|
||||
def main(u32 e) -> (u32):
|
||||
return right_rotate_6(e) ^ right_rotate_11(e) ^ right_rotate_25(e)
|
Loading…
Reference in a new issue