Skip to content

Commit

Permalink
values: add some Eq methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Nov 20, 2023
1 parent 1d58097 commit c3582d1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/sim/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ pub enum ScalarValue {
Big(BigUint),
}

impl PartialEq for ScalarValue {
fn eq(&self, other: &Self) -> bool {
todo!()
}
}

#[derive(Debug)]
pub enum Value {
Scalar(ScalarValue),
Expand All @@ -260,6 +266,17 @@ impl Value {
}
}

impl PartialEq for Value {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Value::Scalar(us), Value::Scalar(other)) => us == other,
(Value::Array(us), Value::Array(other)) => us == other,
// arrays and scalars always compare as unequal
(_, _) => false,
}
}
}

#[derive(Debug)]
pub enum ValueRef<'a> {
Scalar(ScalarValueRef<'a>),
Expand Down Expand Up @@ -491,6 +508,13 @@ impl Clone for ArrayValue {
}
}

impl PartialEq for ArrayValue {
fn eq(&self, other: &Self) -> bool {
todo!()
}
}


impl ArrayValue {
pub fn new_sparse(index_tpe: Type, default: ScalarValue) -> Self {
let index_store = smt_tpe_to_storage_tpe(index_tpe).as_scalar();
Expand Down

0 comments on commit c3582d1

Please sign in to comment.