about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
blob: 4c3ed5987509507bf0ff2c759125d40288d79b87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
let
  cmp = a: b:
    let
      ord1 = builtins.compareVersions a b;
      ord2 = builtins.compareVersions b a;
    in
      assert ord1 == -ord2; ord1;
in

[
  (cmp "1.2.3" "1.2.3")
  (cmp "1.2.2" "1.2.3")
  (cmp "1.2.3" "1.2.40")
  (cmp "1.2.3" ".1.2.3")
  (cmp "1.2.3" "1..2.3")
  (cmp "1.2.3" "1.2.3.")
  (cmp "1.2.3" "1.2")
  (cmp "1.2.3" "1.2.a")
  (cmp "1a.b" "1a.2")
  (cmp "1" "")
]