2019-05-13 12:10:23 +00:00
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
|
|
|
pub enum Error {
|
|
|
|
/// The value in the test didn't match our value.
|
|
|
|
NotEqual(String),
|
|
|
|
/// The test specified a failure and we did not experience one.
|
|
|
|
DidntFail(String),
|
|
|
|
/// Failed to parse the test (internal error).
|
|
|
|
FailedToParseTest(String),
|
2020-09-26 01:58:29 +00:00
|
|
|
/// Test case contained invalid BLS data.
|
|
|
|
InvalidBLSInput(String),
|
2019-06-12 05:47:32 +00:00
|
|
|
/// Skipped the test because the BLS setting was mismatched.
|
|
|
|
SkippedBls,
|
|
|
|
/// Skipped the test because it's known to fail.
|
|
|
|
SkippedKnownFailure,
|
2019-05-13 12:10:23 +00:00
|
|
|
}
|
2019-05-22 08:55:00 +00:00
|
|
|
|
|
|
|
impl Error {
|
|
|
|
pub fn name(&self) -> &str {
|
|
|
|
match self {
|
|
|
|
Error::NotEqual(_) => "NotEqual",
|
|
|
|
Error::DidntFail(_) => "DidntFail",
|
|
|
|
Error::FailedToParseTest(_) => "FailedToParseTest",
|
2020-09-26 01:58:29 +00:00
|
|
|
Error::InvalidBLSInput(_) => "InvalidBLSInput",
|
2019-06-12 05:47:32 +00:00
|
|
|
Error::SkippedBls => "SkippedBls",
|
|
|
|
Error::SkippedKnownFailure => "SkippedKnownFailure",
|
2019-05-22 08:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn message(&self) -> &str {
|
|
|
|
match self {
|
|
|
|
Error::NotEqual(m) => m.as_str(),
|
|
|
|
Error::DidntFail(m) => m.as_str(),
|
|
|
|
Error::FailedToParseTest(m) => m.as_str(),
|
2020-09-26 01:58:29 +00:00
|
|
|
Error::InvalidBLSInput(m) => m.as_str(),
|
2019-06-12 05:47:32 +00:00
|
|
|
_ => self.name(),
|
2019-06-11 08:06:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_skipped(&self) -> bool {
|
2020-10-15 21:42:43 +00:00
|
|
|
matches!(self, Error::SkippedBls | Error::SkippedKnownFailure)
|
2019-05-22 08:55:00 +00:00
|
|
|
}
|
|
|
|
}
|