about summary refs log tree commit diff
path: root/users/sterni/nix/num/tests/default.nix
blob: ca5f861debe8d454c607199035aa604dfeffd5bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ depot, ... }:

let

  inherit (depot.nix.runTestsuite)
    runTestsuite
    it
    assertEq
    ;

  inherit (depot.users.sterni.nix)
    num
    ;

  testsBasic = it "tests basic operations" [
    (assertEq "abs -4959" (num.abs (-4959)) 4959)
    (assertEq "sum" (num.sum [ 123 321 1.5 ]) (123 + 321 + 1.5))
    (assertEq "inRange"
      (builtins.map (num.inRange 1.0 5) [ 0 0.5 3 4 4.5 5.5 5 6 ])
      [ false false true true true false true false ])
  ];
in

runTestsuite "nix.num" [
  testsBasic
]