1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

add add test

This commit is contained in:
schaeff 2020-02-25 10:43:52 +01:00
parent ca53a928ee
commit 6b988c1dae
6 changed files with 56 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"entry_point": "./tests/tests/uint/add.zok",
"constraint_count": 29,
"constraint_count": 102,
"tests": [
{
"input": {

View file

@ -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

View 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"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 e, u32 f, u32 g) -> (u32):
return (e + f) ^ (!e + g)

View file

@ -0,0 +1,16 @@
{
"entry_point": "./tests/tests/uint/rotate.zok",
"constraint_count": 98,
"tests": [
{
"input": {
"values": ["0"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View 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)