Skip to content

Commit

Permalink
Merge pull request #408 from gizatechxyz/upgrade-cairo-version
Browse files Browse the repository at this point in the history
Upgrade Cairo and Scarb to 2.3.0
  • Loading branch information
raphaelDkhn authored Oct 26, 2023
2 parents 8393df1 + 114cdfc commit 52a3888
Show file tree
Hide file tree
Showing 1,778 changed files with 3,224 additions and 3,211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "0.7.0"
scarb-version: "2.3.0"
- run: scarb test --workspace && scarb fmt --workspace
20 changes: 20 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "alexandria_data_structures"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=f37d73d#f37d73d8a8248e4d8dc65de3949333e30bda022f"

[[package]]
name = "cubit"
version = "1.2.0"
source = "git+https://github.com/raphaelDkhn/cubit.git#e6331ebf98c5d5f442a0e5edefe0b367c8e270d9"

[[package]]
name = "orion"
version = "0.1.2"
dependencies = [
"alexandria_data_structures",
"cubit",
]
7 changes: 2 additions & 5 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ homepage = "https://github.com/gizatechxyz/orion"

[dependencies]
alexandria_data_structures = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "f37d73d" }
cubit = { git = "https://github.com/influenceth/cubit.git" }
cubit = { git = "https://github.com/raphaelDkhn/cubit.git" }

[scripts]
sierra = "cairo-compile . -r"
docgen = "cd docgen && cargo run"
nodegen = "python3 nodegen/node/__init__.py"

[workspace]
members = ["tests/"]
nodegen = "python3 nodegen/node/__init__.py"
2 changes: 1 addition & 1 deletion src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod operators;
mod numbers;
mod utils;

mod test_helper;
2 changes: 1 addition & 1 deletion src/numbers/fixed_point/implementations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ mod fp16x16;
mod fp64x64;
mod fp32x32;
mod fp16x16wide;
mod fp8x23wide;
mod fp8x23wide;
70 changes: 38 additions & 32 deletions src/numbers/fixed_point/implementations/fp16x16/math/comp.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,46 @@ fn and(a: FP16x16, b: FP16x16) -> bool {

// Tests --------------------------------------------------------------------------------------------------------------

#[test]
fn test_max() {
let a = FixedTrait::new_unscaled(1, false);
let b = FixedTrait::new_unscaled(0, false);
let c = FixedTrait::new_unscaled(1, true);

assert(max(a, a) == a, 'max(a, a)');
assert(max(a, b) == a, 'max(a, b)');
assert(max(a, c) == a, 'max(a, c)');

assert(max(b, a) == a, 'max(b, a)');
assert(max(b, b) == b, 'max(b, b)');
assert(max(b, c) == b, 'max(b, c)');

assert(max(c, a) == a, 'max(c, a)');
assert(max(c, b) == b, 'max(c, b)');
assert(max(c, c) == c, 'max(c, c)');
}
#[cfg(test)]
mod tests {
use super::{FixedTrait, max, min};


#[test]
fn test_max() {
let a = FixedTrait::new_unscaled(1, false);
let b = FixedTrait::new_unscaled(0, false);
let c = FixedTrait::new_unscaled(1, true);

assert(max(a, a) == a, 'max(a, a)');
assert(max(a, b) == a, 'max(a, b)');
assert(max(a, c) == a, 'max(a, c)');

#[test]
fn test_min() {
let a = FixedTrait::new_unscaled(1, false);
let b = FixedTrait::new_unscaled(0, false);
let c = FixedTrait::new_unscaled(1, true);
assert(max(b, a) == a, 'max(b, a)');
assert(max(b, b) == b, 'max(b, b)');
assert(max(b, c) == b, 'max(b, c)');

assert(min(a, a) == a, 'min(a, a)');
assert(min(a, b) == b, 'min(a, b)');
assert(min(a, c) == c, 'min(a, c)');
assert(max(c, a) == a, 'max(c, a)');
assert(max(c, b) == b, 'max(c, b)');
assert(max(c, c) == c, 'max(c, c)');
}

#[test]
fn test_min() {
let a = FixedTrait::new_unscaled(1, false);
let b = FixedTrait::new_unscaled(0, false);
let c = FixedTrait::new_unscaled(1, true);

assert(min(b, a) == b, 'min(b, a)');
assert(min(b, b) == b, 'min(b, b)');
assert(min(b, c) == c, 'min(b, c)');
assert(min(a, a) == a, 'min(a, a)');
assert(min(a, b) == b, 'min(a, b)');
assert(min(a, c) == c, 'min(a, c)');

assert(min(c, a) == c, 'min(c, a)');
assert(min(c, b) == c, 'min(c, b)');
assert(min(c, c) == c, 'min(c, c)');
assert(min(b, a) == b, 'min(b, a)');
assert(min(b, b) == b, 'min(b, b)');
assert(min(b, c) == c, 'min(b, c)');

assert(min(c, a) == c, 'min(c, a)');
assert(min(c, b) == c, 'min(c, b)');
assert(min(c, c) == c, 'min(c, c)');
}
}
Loading

0 comments on commit 52a3888

Please sign in to comment.