increase code coverage for bit integers
This commit is contained in:
parent
d6ac99f1d7
commit
6e7938f969
@ -229,7 +229,10 @@ from_smaller_integer!(u8);
|
|||||||
|
|
||||||
impl fmt::Debug for Number {
|
impl fmt::Debug for Number {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "Number {{ {} }}", self)
|
match self {
|
||||||
|
Self::Machine(..) => write!(f, "Number::Machine( {} )", self),
|
||||||
|
Self::Big(..) => write!(f, "Number::Big( {} )", self),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ test!(
|
|||||||
"a {\n color: floor(10.6px);\n}\n",
|
"a {\n color: floor(10.6px);\n}\n",
|
||||||
"a {\n color: 10px;\n}\n"
|
"a {\n color: 10px;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
floor_big_int,
|
||||||
|
"a {\n color: floor(1.000000000000000001);\n}\n",
|
||||||
|
"a {\n color: 1;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
ceil_below_pt_5,
|
ceil_below_pt_5,
|
||||||
"a {\n color: ceil(10.4px);\n}\n",
|
"a {\n color: ceil(10.4px);\n}\n",
|
||||||
@ -48,6 +53,11 @@ test!(
|
|||||||
"a {\n color: ceil(10.6px);\n}\n",
|
"a {\n color: ceil(10.6px);\n}\n",
|
||||||
"a {\n color: 11px;\n}\n"
|
"a {\n color: 11px;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
ceil_big_int,
|
||||||
|
"a {\n color: ceil(1.000000000000000001);\n}\n",
|
||||||
|
"a {\n color: 2;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
abs_positive,
|
abs_positive,
|
||||||
"a {\n color: abs(10);\n}\n",
|
"a {\n color: abs(10);\n}\n",
|
||||||
@ -93,3 +103,13 @@ test!(
|
|||||||
"a {\n color: comparable($number1: 1, $number2: 2);\n}\n",
|
"a {\n color: comparable($number1: 1, $number2: 2);\n}\n",
|
||||||
"a {\n color: true;\n}\n"
|
"a {\n color: true;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
random_limit_one,
|
||||||
|
"a {\n color: random(1);\n}\n",
|
||||||
|
"a {\n color: 1;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
random_limit_big_one,
|
||||||
|
"a {\n color: random(1000000000000000001 - 1000000000000000000);\n}\n",
|
||||||
|
"a {\n color: 1;\n}\n"
|
||||||
|
);
|
||||||
|
@ -168,3 +168,22 @@ error!(
|
|||||||
scientific_notation_ident_char_after_dash,
|
scientific_notation_ident_char_after_dash,
|
||||||
"a {\n color: 1e-a;\n}\n", "Error: Expected digit."
|
"a {\n color: 1e-a;\n}\n", "Error: Expected digit."
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
number_overflow_from_addition,
|
||||||
|
"a {\n color: 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999
|
||||||
|
+ 999999999999999999;\n}\n",
|
||||||
|
"a {\n color: 9999999999999999990;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
number_overflow_from_multiplication,
|
||||||
|
"a {\n color: 999999999999999999 * 10;\n}\n",
|
||||||
|
"a {\n color: 9999999999999999990;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user