use thiserror::Error;
#[derive(Error, Debug, PartialEq, Clone)]
pub enum BooleanFunctionError {
#[error("Hex truth table length must be a power of 2")]
WrongStringHexTruthTableLength,
#[error("Error parsing string hex number")]
StringHexParseError,
#[error("Too big variable count, must be <= {0}")]
TooBigVariableCount(usize),
#[error("Unexpected error, this shouldn't happen. Please report this issue to the crate maintainer.")]
UnexpectedError,
#[error("Too big derivative direction, must be <= {0}")]
TooBigDerivativeDirection(u32),
#[error("Invalid number of Walsh values {0}, should be 2^n, n >= 2")]
InvalidWalshValuesCount(usize),
#[error("Truth table is too big for variables count")]
TooBigTruthTableForVarCount,
#[error("This Boolean function is already balanced")]
AlreadyBalanced,
#[error("Error parsing ANF string, should be in the form \"x0*x2*x3 + x2*x3 + x1 + 1\"")]
ErrorParsingAnfString,
#[error("There are {0} variables in this ANF form, x{1} factor shouldn't appear")]
AnfFormNVariableTooBigFactor(usize, usize),
}
pub(crate) const XOR_DIFFERENT_VAR_COUNT_PANIC_MSG: &'static str =
"XOR operation requires the same number of variables in both functions";
pub(crate) const AND_DIFFERENT_VAR_COUNT_PANIC_MSG: &'static str =
"AND operation requires the same number of variables in both functions";
#[cfg(not(feature = "unsafe_disable_safety_checks"))]
pub(crate) const TRUTH_TABLE_TOO_BIG_VAR_COUNT_PANIC_MSG: &'static str =
"Truth table is too big for variables count";
#[cfg(not(feature = "unsafe_disable_safety_checks"))]
pub(crate) const POLYNOMIAL_ANF_TOO_BIG_VAR_COUNT_PANIC_MSG: &'static str =
"Polynomial ANF is too big for variables count";