fix test in other crates
This commit is contained in:
parent
52d8065f37
commit
e7940a3c97
2 changed files with 72 additions and 24 deletions
|
@ -406,7 +406,9 @@ mod tests {
|
||||||
|
|
||||||
mod strict {
|
mod strict {
|
||||||
use super::*;
|
use super::*;
|
||||||
use zokrates_core::typed_absy::types::{StructMember, StructType};
|
use zokrates_core::typed_absy::types::{
|
||||||
|
ConcreteStructMember, ConcreteStructType, ConcreteType,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fields() {
|
fn fields() {
|
||||||
|
@ -441,8 +443,11 @@ mod tests {
|
||||||
fn array() {
|
fn array() {
|
||||||
let s = "[[true, false]]";
|
let s = "[[true, false]]";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_strict::<Bn128Field>(s, vec![ConcreteType::array(ConcreteType::Boolean, 2)])
|
parse_strict::<Bn128Field>(
|
||||||
.unwrap(),
|
s,
|
||||||
|
vec![ConcreteType::array(ConcreteType::Boolean, 2usize)]
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
CheckedValues(vec![CheckedValue::Array(vec![
|
CheckedValues(vec![CheckedValue::Array(vec![
|
||||||
CheckedValue::Boolean(true),
|
CheckedValue::Boolean(true),
|
||||||
CheckedValue::Boolean(false)
|
CheckedValue::Boolean(false)
|
||||||
|
@ -456,10 +461,13 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_strict::<Bn128Field>(
|
parse_strict::<Bn128Field>(
|
||||||
s,
|
s,
|
||||||
vec![ConcreteType::Struct(StructType::new(
|
vec![ConcreteType::Struct(ConcreteStructType::new(
|
||||||
"".into(),
|
"".into(),
|
||||||
"".into(),
|
"".into(),
|
||||||
vec![StructMember::new("a".into(), ConcreteType::FieldElement)]
|
vec![ConcreteStructMember::new(
|
||||||
|
"a".into(),
|
||||||
|
ConcreteType::FieldElement
|
||||||
|
)]
|
||||||
))]
|
))]
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
@ -474,10 +482,13 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_strict::<Bn128Field>(
|
parse_strict::<Bn128Field>(
|
||||||
s,
|
s,
|
||||||
vec![ConcreteType::Struct(StructType::new(
|
vec![ConcreteType::Struct(ConcreteStructType::new(
|
||||||
"".into(),
|
"".into(),
|
||||||
"".into(),
|
"".into(),
|
||||||
vec![StructMember::new("a".into(), ConcreteType::FieldElement)]
|
vec![ConcreteStructMember::new(
|
||||||
|
"a".into(),
|
||||||
|
ConcreteType::FieldElement
|
||||||
|
)]
|
||||||
))]
|
))]
|
||||||
)
|
)
|
||||||
.unwrap_err(),
|
.unwrap_err(),
|
||||||
|
@ -488,10 +499,13 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_strict::<Bn128Field>(
|
parse_strict::<Bn128Field>(
|
||||||
s,
|
s,
|
||||||
vec![ConcreteType::Struct(StructType::new(
|
vec![ConcreteType::Struct(ConcreteStructType::new(
|
||||||
"".into(),
|
"".into(),
|
||||||
"".into(),
|
"".into(),
|
||||||
vec![StructMember::new("a".into(), ConcreteType::FieldElement)]
|
vec![ConcreteStructMember::new(
|
||||||
|
"a".into(),
|
||||||
|
ConcreteType::FieldElement
|
||||||
|
)]
|
||||||
))]
|
))]
|
||||||
)
|
)
|
||||||
.unwrap_err(),
|
.unwrap_err(),
|
||||||
|
@ -502,10 +516,13 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_strict::<Bn128Field>(
|
parse_strict::<Bn128Field>(
|
||||||
s,
|
s,
|
||||||
vec![ConcreteType::Struct(StructType::new(
|
vec![ConcreteType::Struct(ConcreteStructType::new(
|
||||||
"".into(),
|
"".into(),
|
||||||
"".into(),
|
"".into(),
|
||||||
vec![StructMember::new("a".into(), ConcreteType::FieldElement)]
|
vec![ConcreteStructMember::new(
|
||||||
|
"a".into(),
|
||||||
|
ConcreteType::FieldElement
|
||||||
|
)]
|
||||||
))]
|
))]
|
||||||
)
|
)
|
||||||
.unwrap_err(),
|
.unwrap_err(),
|
||||||
|
|
|
@ -921,6 +921,7 @@ mod tests {
|
||||||
pragma: None,
|
pragma: None,
|
||||||
structs: vec![],
|
structs: vec![],
|
||||||
functions: vec![Function {
|
functions: vec![Function {
|
||||||
|
generics: vec![],
|
||||||
id: IdentifierExpression {
|
id: IdentifierExpression {
|
||||||
value: String::from("main"),
|
value: String::from("main"),
|
||||||
span: Span::new(&source, 33, 37).unwrap()
|
span: Span::new(&source, 33, 37).unwrap()
|
||||||
|
@ -933,14 +934,18 @@ mod tests {
|
||||||
expressions: vec![Expression::add(
|
expressions: vec![Expression::add(
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 59, 60).unwrap()
|
||||||
|
},
|
||||||
suffix: None,
|
suffix: None,
|
||||||
span: Span::new(&source, 59, 60).unwrap()
|
span: Span::new(&source, 59, 60).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 63, 64).unwrap()
|
||||||
|
},
|
||||||
suffix: None,
|
suffix: None,
|
||||||
span: Span::new(&source, 63, 64).unwrap()
|
span: Span::new(&source, 63, 64).unwrap()
|
||||||
}
|
}
|
||||||
|
@ -976,6 +981,7 @@ mod tests {
|
||||||
pragma: None,
|
pragma: None,
|
||||||
structs: vec![],
|
structs: vec![],
|
||||||
functions: vec![Function {
|
functions: vec![Function {
|
||||||
|
generics: vec![],
|
||||||
id: IdentifierExpression {
|
id: IdentifierExpression {
|
||||||
value: String::from("main"),
|
value: String::from("main"),
|
||||||
span: Span::new(&source, 33, 37).unwrap()
|
span: Span::new(&source, 33, 37).unwrap()
|
||||||
|
@ -989,7 +995,9 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 59, 60).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 59, 60).unwrap()
|
span: Span::new(&source, 59, 60).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
@ -997,7 +1005,9 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("2"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 63, 64).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 63, 64).unwrap()
|
span: Span::new(&source, 63, 64).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
@ -1005,14 +1015,18 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("3"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 67, 68).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 67, 68).unwrap()
|
span: Span::new(&source, 67, 68).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("4"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 72, 73).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 72, 73).unwrap()
|
span: Span::new(&source, 72, 73).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
@ -1051,6 +1065,7 @@ mod tests {
|
||||||
pragma: None,
|
pragma: None,
|
||||||
structs: vec![],
|
structs: vec![],
|
||||||
functions: vec![Function {
|
functions: vec![Function {
|
||||||
|
generics: vec![],
|
||||||
id: IdentifierExpression {
|
id: IdentifierExpression {
|
||||||
value: String::from("main"),
|
value: String::from("main"),
|
||||||
span: Span::new(&source, 33, 37).unwrap()
|
span: Span::new(&source, 33, 37).unwrap()
|
||||||
|
@ -1064,21 +1079,27 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 62, 63).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 62, 63).unwrap()
|
span: Span::new(&source, 62, 63).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("2"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 69, 70).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 69, 70).unwrap()
|
span: Span::new(&source, 69, 70).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("3"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 76, 77).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 76, 77).unwrap()
|
span: Span::new(&source, 76, 77).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
@ -1112,6 +1133,7 @@ mod tests {
|
||||||
pragma: None,
|
pragma: None,
|
||||||
structs: vec![],
|
structs: vec![],
|
||||||
functions: vec![Function {
|
functions: vec![Function {
|
||||||
|
generics: vec![],
|
||||||
id: IdentifierExpression {
|
id: IdentifierExpression {
|
||||||
value: String::from("main"),
|
value: String::from("main"),
|
||||||
span: Span::new(&source, 4, 8).unwrap()
|
span: Span::new(&source, 4, 8).unwrap()
|
||||||
|
@ -1124,7 +1146,9 @@ mod tests {
|
||||||
expressions: vec![Expression::Literal(LiteralExpression::DecimalLiteral(
|
expressions: vec![Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 31, 32).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 31, 32).unwrap()
|
span: Span::new(&source, 31, 32).unwrap()
|
||||||
}
|
}
|
||||||
))],
|
))],
|
||||||
|
@ -1149,6 +1173,7 @@ mod tests {
|
||||||
pragma: None,
|
pragma: None,
|
||||||
structs: vec![],
|
structs: vec![],
|
||||||
functions: vec![Function {
|
functions: vec![Function {
|
||||||
|
generics: vec![],
|
||||||
id: IdentifierExpression {
|
id: IdentifierExpression {
|
||||||
value: String::from("main"),
|
value: String::from("main"),
|
||||||
span: Span::new(&source, 4, 8).unwrap()
|
span: Span::new(&source, 4, 8).unwrap()
|
||||||
|
@ -1196,7 +1221,9 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("1"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 40, 41).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 40, 41).unwrap()
|
span: Span::new(&source, 40, 41).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
@ -1204,14 +1231,18 @@ mod tests {
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("2"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 43, 44).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 43, 44).unwrap()
|
span: Span::new(&source, 43, 44).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
Expression::Literal(LiteralExpression::DecimalLiteral(
|
Expression::Literal(LiteralExpression::DecimalLiteral(
|
||||||
DecimalLiteralExpression {
|
DecimalLiteralExpression {
|
||||||
suffix: None,
|
suffix: None,
|
||||||
value: String::from("3"),
|
value: DecimalNumber {
|
||||||
|
span: Span::new(&source, 47, 48).unwrap()
|
||||||
|
},
|
||||||
span: Span::new(&source, 47, 48).unwrap()
|
span: Span::new(&source, 47, 48).unwrap()
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
|
|
Loading…
Reference in a new issue