ref: a367763275faf9bbda3196f58998e9e74484a9a0
dir: /lib/std/test/cmp.myr/
use std const main = { expect(std.strcmp, "foo", "bar", `std.After) expect(std.strcmp, "foo", "foo", `std.Equal) expect(std.strcmp, "foo", "foos", `std.Before) expect(std.strcmp, "Foo", "foos", `std.Before) expect1(std.strncmp, "foo", "bar", 3, `std.After) expect1(std.strncmp, "foo", "foo", 3, `std.Equal) expect1(std.strncmp, "foo", "foos", 3, `std.Equal) expect1(std.strncmp, "foo", "foos", 4, `std.Before) expect1(std.strncmp, "Foo", "foos", 2, `std.Before) expect(std.strcasecmp, "FOo", "bar", `std.After) expect(std.strcasecmp, "FOo", "Bar", `std.After) expect(std.strcasecmp, "FOo", "FUCK", `std.Before) expect(std.strcasecmp, "FOo", "fuck", `std.Before) expect(std.strcasecmp, "FOo", "foo", `std.Equal) expect(std.strcasecmp, "FOo", "foos", `std.Before) expect(std.strcasecmp, "FOo", "bar", `std.After) expect(std.strcasecmp, "FOo", "foo", `std.Equal) expect(std.strcasecmp, "FOo", "foos", `std.Before) expect(std.strcasecmp, "Γειά σας", "γειά σας", `std.Equal) expect(std.strcasecmp, "γειά σας", "γειά σας", `std.Equal) expect(std.strcasecmp, "γειά σας", "Γειά σας", `std.Equal) expect(std.strcasecmp, "γειά", "Γειά σας", `std.Before) } const expect = {fn, a, b, e var val val = fn(a, b) match (val, e) | (`std.Before, `std.Before): /* nothing */ | (`std.After, `std.After): /* nothing */ | (`std.Equal, `std.Equal): /* nothing */ | _: std.fatal("cmp {}, {}: expected {}, got {}\n", a, b, e, val) ;; } const expect1 = {fn, a, b, n, e var val val = fn(a, b, n) match (val, e) | (`std.Before, `std.Before): /* nothing */ | (`std.After, `std.After): /* nothing */ | (`std.Equal, `std.Equal): /* nothing */ | _: std.fatal("cmp {}, {}: expected {}, got {}\n", a, b, e, val) ;; }