about summary refs log tree commit diff
path: root/users/sterni/nix/char/tests/default.nix
blob: cb17b74c578f86c610403fc00ded42a719973112 (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
27
28
29
30
31
{ depot, ... }:

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

  inherit (depot.users.sterni.nix)
    char
    string
    num
    fun
    ;

  charList = string.toChars char.allChars;

  testAllCharConversion = it "tests conversion of all chars" [
    (assertEq "char.chr converts to char.allChars"
      (builtins.genList (fun.rl char.chr (num.add 1)) 255)
      charList)
    (assertEq "char.ord converts from char.allChars"
      (builtins.genList (num.add 1) 255)
      (builtins.map char.ord charList))
  ];

in
runTestsuite "char" [
  testAllCharConversion
]