nixos-config/tests/lib/math.nix
Gabriel Arazas c782c20a4a
lib/math: init subset
Just copied over from Bahaghari lul
2024-09-12 15:46:45 +08:00

35 lines
553 B
Nix

{ pkgs, lib, self }:
lib.runTests {
testMathAbsoluteValue = {
expr = self.math.abs 5493;
expected = 5493;
};
testMathAbsoluteValue2 = {
expr = self.math.abs (-435354);
expected = 435354;
};
testMathPowPositive = {
expr = self.math.pow 2 8;
expected = 256;
};
testMathPowNegative = {
expr = self.math.pow 2.0 (-1);
expected = 0.5;
};
testMathPowZero = {
expr = self.math.pow 31 0;
expected = 1;
};
testsMathPowWithFloat = {
expr = self.math.pow 2 7.0;
expected = 128.0;
};
}