Skip to content

Commit

Permalink
Enable and fix deref_test. (#7106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalesokhin-starkware authored Jan 16, 2025
1 parent 739ecc2 commit c400112
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions corelib/src/test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod circuit_test;
mod clone_test;
mod cmp_test;
mod coupon_test;
mod deref_test;
mod dict_test;
mod ec_test;
mod felt_test;
Expand Down
14 changes: 7 additions & 7 deletions corelib/src/test/deref_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ struct S3 {
}


impl S2Deref of crate::ops::deref::Deref<S2> {
impl S2Deref of crate::ops::Deref<S2> {
type Target = S1;
fn deref(self: S2) -> S1 {
self.inner
}
}

impl S3Deref of crate::ops::deref::Deref<S3> {
impl S3Deref of crate::ops::Deref<S3> {
type Target = S2;
fn deref(self: S3) -> S2 {
self.inner
Expand All @@ -50,7 +50,7 @@ enum E1 {
V2: S1,
}

impl E1Deref of crate::ops::deref::Deref<E1> {
impl E1Deref of crate::ops::Deref<E1> {
type Target = S1;
fn deref(self: E1) -> S1 {
match self {
Expand All @@ -74,7 +74,7 @@ enum E3 {
V2: S3,
}

impl E3Deref of crate::ops::deref::Deref<E3> {
impl E3Deref of crate::ops::Deref<E3> {
type Target = S3;
fn deref(self: E3) -> S3 {
match self {
Expand Down Expand Up @@ -103,7 +103,7 @@ struct S4 {
a: usize,
}

impl S4Deref of crate::ops::deref::Deref<S4> {
impl S4Deref of crate::ops::Deref<S4> {
type Target = E3;
fn deref(self: S4) -> E3 {
self.e3
Expand Down Expand Up @@ -132,15 +132,15 @@ struct ArithOps {
div: usize,
}

impl UsizeTupleDeref of crate::ops::deref::Deref<(usize, usize)> {
impl UsizeTupleDeref of crate::ops::Deref<(usize, usize)> {
type Target = ArithOps;
fn deref(self: (usize, usize)) -> ArithOps {
let (x, y) = self;
ArithOps { add: x + y, sub: x - y, mul: x * y, div: x / y }
}
}

impl UsizeFixedSizeArrayDeref of crate::ops::deref::Deref<[usize; 2]> {
impl UsizeFixedSizeArrayDeref of crate::ops::Deref<[usize; 2]> {
type Target = ArithOps;
fn deref(self: [usize; 2]) -> ArithOps {
let [x, y] = self;
Expand Down

0 comments on commit c400112

Please sign in to comment.