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

update book and spacing

This commit is contained in:
dark64 2021-04-06 19:26:50 +02:00
parent e6cfec4276
commit 3cd2755c3e
49 changed files with 711 additions and 711 deletions

View file

@ -22,7 +22,7 @@ Note that for field elements, the division operation multiplies the numerator wi
Booleans are available in ZoKrates. When a boolean is used as a parameter of the main function, the program is constrained to only accept `0` or `1` for that parameter. A boolean can be asserted to be true using an `assert(bool)` statement.
### `u8/u16/u32`
### `u8/u16/u32/u64`
Unsigned integers represent positive numbers of the interval `[0, 2 ** bitwidth[`, where `bitwidth` is specified in the type's name, e.g., 32 bits in the case of u32. Their arithmetics are defined modulo `2 ** bitwidth`.
@ -34,9 +34,9 @@ The division operation calculates the standard floor division for integers. The
### Numeric inference
In the case of decimal literals like `42`, the compiler tries to find the appropriate type (`field`, `u8`, `u16` or `u32`) depending on the context. If it cannot converge to a single option, an error is returned. This means that there is no default type for decimal literals.
In the case of decimal literals like `42`, the compiler tries to find the appropriate type (`field`, `u8`, `u16`, `u32` or `u64`) depending on the context. If it cannot converge to a single option, an error is returned. This means that there is no default type for decimal literals.
All operations between literals have the semantics of the infered type.
All operations between literals have the semantics of the inferred type.
```zokrates
{{#include ../../../zokrates_cli/examples/book/numeric_inference.zok}}

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/and.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x1230"]
}
}
}
]
"entry_point": "./tests/tests/uint/u16/and.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x1230"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a & b
return a & b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/div.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x1000", "0x1000"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
},
{
"input": {
"values": ["0x1000", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
}
]
"entry_point": "./tests/tests/uint/u16/div.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x1000", "0x1000"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
},
{
"input": {
"values": ["0x1000", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x / y
return x / y

View file

@ -1,2 +1,2 @@
def main(u16 x) -> u16:
return x << 1
return x << 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/or.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x567c"]
}
}
}
]
"entry_point": "./tests/tests/uint/u16/or.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x567c"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x | y
return x | y

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/rem.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["0x0002"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0001"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
}
]
"entry_point": "./tests/tests/uint/u16/rem.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["0x0002"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0001"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x % y
return x % y

View file

@ -1,2 +1,2 @@
def main(u16 x) -> u16:
return x >> 1
return x >> 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/xor.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x444c"]
}
}
}
]
"entry_point": "./tests/tests/uint/u16/xor.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x444c"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a ^ b
return a ^ b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/and.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x02244220"]
}
}
}
]
"entry_point": "./tests/tests/uint/u32/and.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x02244220"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a & b
return a & b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/div.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x10000000", "0x10000000"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
},
{
"input": {
"values": ["0x10000000", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
}
]
"entry_point": "./tests/tests/uint/u32/div.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x10000000", "0x10000000"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
},
{
"input": {
"values": ["0x10000000", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x / y
return x / y

View file

@ -1,2 +1,2 @@
def main(u32 x) -> u32:
return x << 1
return x << 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/or.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x97755779"]
}
}
}
]
"entry_point": "./tests/tests/uint/u32/or.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x97755779"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x | y
return x | y

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/rem.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["0x00000002"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
}
]
"entry_point": "./tests/tests/uint/u32/rem.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["0x00000002"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x % y
return x % y

View file

@ -1,2 +1,2 @@
def main(u32 x) -> u32:
return x >> 1
return x >> 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/xor.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x95511559"]
}
}
}
]
"entry_point": "./tests/tests/uint/u32/xor.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x95511559"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a ^ b
return a ^ b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/and.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x224422002244220"]
}
}
}
]
"entry_point": "./tests/tests/uint/u64/and.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x224422002244220"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u64 a, u64 b) -> u64:
return a & b
return a & b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/div.zok",
"max_constraint_count": 328,
"tests": [
{
"input": {
"values": ["0x1000000000000000", "0x1000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000001"]
}
}
},
{
"input": {
"values": ["0x1000000000000000", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000001", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
}
]
"entry_point": "./tests/tests/uint/u64/div.zok",
"max_constraint_count": 328,
"tests": [
{
"input": {
"values": ["0x1000000000000000", "0x1000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000001"]
}
}
},
{
"input": {
"values": ["0x1000000000000000", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000001", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u64 x, u64 y) -> u64:
return x / y
return x / y

View file

@ -1,2 +1,2 @@
def main(u64 x) -> u64:
return x << 1
return x << 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/or.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x9775577997755779"]
}
}
}
]
"entry_point": "./tests/tests/uint/u64/or.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x9775577997755779"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u64 x, u64 y) -> u64:
return x | y
return x | y

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/rem.zok",
"max_constraint_count": 328,
"tests": [
{
"input": {
"values": ["0x0000000000000002", "0x0000000000000004"]
},
"output": {
"Ok": {
"values": ["0x0000000000000002"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000001"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000001", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0000000000000001"]
}
}
}
]
"entry_point": "./tests/tests/uint/u64/rem.zok",
"max_constraint_count": 328,
"tests": [
{
"input": {
"values": ["0x0000000000000002", "0x0000000000000004"]
},
"output": {
"Ok": {
"values": ["0x0000000000000002"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000001"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000001", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0000000000000001"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u64 x, u64 y) -> u64:
return x % y
return x % y

View file

@ -1,2 +1,2 @@
def main(u64 x) -> u64:
return x >> 1
return x >> 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/xor.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x9551155995511559"]
}
}
}
]
"entry_point": "./tests/tests/uint/u64/xor.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x9551155995511559"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u64 a, u64 b) -> u64:
return a ^ b
return a ^ b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u8/and.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x20"]
}
}
}
]
"entry_point": "./tests/tests/uint/u8/and.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x20"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u8 a, u8 b) -> u8:
return a & b
return a & b

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u8/div.zok",
"max_constraint_count": 48,
"tests": [
{
"input": {
"values": ["0x02", "0x02"]
},
"output": {
"Ok": {
"values": ["0x01"]
}
}
},
{
"input": {
"values": ["0x04", "0x02"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
},
{
"input": {
"values": ["0x2a", "0x0a"]
},
"output": {
"Ok": {
"values": ["0x04"]
}
}
}
]
"entry_point": "./tests/tests/uint/u8/div.zok",
"max_constraint_count": 48,
"tests": [
{
"input": {
"values": ["0x02", "0x02"]
},
"output": {
"Ok": {
"values": ["0x01"]
}
}
},
{
"input": {
"values": ["0x04", "0x02"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
},
{
"input": {
"values": ["0x2a", "0x0a"]
},
"output": {
"Ok": {
"values": ["0x04"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u8 x, u8 y) -> u8:
return x / y
return x / y

View file

@ -1,2 +1,2 @@
def main(u8 x) -> u8:
return x << 1
return x << 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u8/or.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x37"]
}
}
}
]
"entry_point": "./tests/tests/uint/u8/or.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x37"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u8 x, u8 y) -> u8:
return x | y
return x | y

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u8/rem.zok",
"max_constraint_count": 48,
"tests": [
{
"input": {
"values": ["0x02", "0x04"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
},
{
"input": {
"values": ["0xff", "0x01"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x2a", "0x0a"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
}
]
"entry_point": "./tests/tests/uint/u8/rem.zok",
"max_constraint_count": 48,
"tests": [
{
"input": {
"values": ["0x02", "0x04"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
},
{
"input": {
"values": ["0xff", "0x01"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x2a", "0x0a"]
},
"output": {
"Ok": {
"values": ["0x02"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u8 x, u8 y) -> u8:
return x % y
return x % y

View file

@ -1,2 +1,2 @@
def main(u8 x) -> u8:
return x >> 1
return x >> 1

View file

@ -1,36 +1,36 @@
{
"entry_point": "./tests/tests/uint/u8/xor.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x17"]
}
}
}
]
"entry_point": "./tests/tests/uint/u8/xor.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x17"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u8 a, u8 b) -> u8:
return a ^ b
return a ^ b