parent
94f9fa9cab
commit
8a90e9eda0
|
@ -10,6 +10,7 @@
|
|||
### Fixed
|
||||
|
||||
- **aiken-lang**: Fix flat encoding and decoding of large integer values. @KtorZ
|
||||
- **aiken**: Ensures that test expected to fail that return `False` are considered to pass & improve error reporting when they fail. @KtorZ
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -821,6 +821,7 @@ where
|
|||
bin_op,
|
||||
left,
|
||||
right,
|
||||
can_error: *can_error,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ pub struct EvalHint {
|
|||
pub bin_op: BinOp,
|
||||
pub left: Program<NamedDeBruijn>,
|
||||
pub right: Program<NamedDeBruijn>,
|
||||
pub can_error: bool,
|
||||
}
|
||||
|
||||
impl Display for EvalHint {
|
||||
|
@ -66,20 +67,42 @@ impl Display for EvalHint {
|
|||
Err(err) => format!("{err}"),
|
||||
},
|
||||
);
|
||||
let msg = match self.bin_op {
|
||||
BinOp::And => Some(format!("{left}\n\nand\n\n{right}\n\nshould both be true.")),
|
||||
BinOp::Or => Some(format!("{left}\n\nor\n\n{right}\n\nshould be true.")),
|
||||
BinOp::Eq => Some(format!("{left}\n\nshould be equal to\n\n{right}")),
|
||||
BinOp::NotEq => Some(format!("{left}\n\nshould not be equal to\n\n{right}")),
|
||||
BinOp::LtInt => Some(format!("{left}\n\nshould be lower than\n\n{right}")),
|
||||
BinOp::LtEqInt => Some(format!(
|
||||
"{left}\n\nshould be lower than or equal to\n\n{right}"
|
||||
)),
|
||||
BinOp::GtEqInt => Some(format!("{left}\n\nshould be greater than\n\n{right}")),
|
||||
BinOp::GtInt => Some(format!(
|
||||
"{left}\n\nshould be greater than or equal to\n\n{right}"
|
||||
)),
|
||||
_ => None,
|
||||
let msg = if self.can_error {
|
||||
match self.bin_op {
|
||||
BinOp::And => Some(format!(
|
||||
"{left}\n\nand\n\n{right}\n\nare both true but shouldn't."
|
||||
)),
|
||||
BinOp::Or => Some(format!(
|
||||
"neither\n\n{left}\n\nnor\n\n{right}\n\nshould be true."
|
||||
)),
|
||||
BinOp::Eq => Some(format!("{left}\n\nshould not be equal to\n\n{right}")),
|
||||
BinOp::NotEq => Some(format!("{left}\n\nshould be equal to\n\n{right}")),
|
||||
BinOp::LtInt => Some(format!(
|
||||
"{left}\n\nshould be greater than or equal to\n\n{right}"
|
||||
)),
|
||||
BinOp::LtEqInt => Some(format!("{left}\n\nshould be greater than\n\n{right}")),
|
||||
BinOp::GtEqInt => Some(format!(
|
||||
"{left}\n\nshould be lower than or equal\n\n{right}"
|
||||
)),
|
||||
BinOp::GtInt => Some(format!("{left}\n\nshould be lower than\n\n{right}")),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
match self.bin_op {
|
||||
BinOp::And => Some(format!("{left}\n\nand\n\n{right}\n\nshould both be true.")),
|
||||
BinOp::Or => Some(format!("{left}\n\nor\n\n{right}\n\nshould be true.")),
|
||||
BinOp::Eq => Some(format!("{left}\n\nshould be equal to\n\n{right}")),
|
||||
BinOp::NotEq => Some(format!("{left}\n\nshould not be equal to\n\n{right}")),
|
||||
BinOp::LtInt => Some(format!("{left}\n\nshould be lower than\n\n{right}")),
|
||||
BinOp::LtEqInt => Some(format!(
|
||||
"{left}\n\nshould be lower than or equal to\n\n{right}"
|
||||
)),
|
||||
BinOp::GtEqInt => Some(format!("{left}\n\nshould be greater than\n\n{right}")),
|
||||
BinOp::GtInt => Some(format!(
|
||||
"{left}\n\nshould be greater than or equal to\n\n{right}"
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
.ok_or(fmt::Error)?;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ impl EvalResult {
|
|||
pub fn failed(&self, can_error: bool) -> bool {
|
||||
if can_error {
|
||||
self.result.is_ok()
|
||||
&& !matches!(self.result, Ok(Term::Constant(ref con)) if matches!(con.as_ref(), Constant::Bool(false)))
|
||||
} else {
|
||||
self.result.is_err()
|
||||
|| matches!(self.result, Ok(Term::Error))
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
requirements = []
|
||||
packages = []
|
||||
|
||||
[etags]
|
|
@ -0,0 +1,2 @@
|
|||
name = "aiken-lang/acceptance_test_091"
|
||||
version = "0.0.0"
|
|
@ -0,0 +1,8 @@
|
|||
test foo_1() fail {
|
||||
False
|
||||
}
|
||||
|
||||
test foo_2() fail {
|
||||
expect 14 == 42
|
||||
True
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"preamble": {
|
||||
"title": "aiken-lang/acceptance_test_090",
|
||||
"version": "0.0.0",
|
||||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.21-alpha+9f263c4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
{
|
||||
"title": "foo.spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Int"
|
||||
}
|
||||
},
|
||||
"redeemer": {
|
||||
"title": "_redeemer",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"compiledCode": "583f010000322223253330053370e00290487777c9cfdde5c8f27bf4c1637fc55b5eeef7d8c4d9e0d4454967ff7d6e7ee6e242eb60c6318a4c26cac6eb400d5cd1",
|
||||
"hash": "d18aa035514acb988a34d33fc246420c5b0eca4f3f947ce95e294447"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"Data": {
|
||||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"Int": {
|
||||
"dataType": "integer"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue