From e119d84731eba52d9e19527fd94f26a7a5f1b9b4 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 14 Jun 2024 23:46:01 +0800 Subject: [PATCH] bahaghari/tests/lib: add more unit tests --- subprojects/bahaghari/tests/lib/hex.nix | 5 +++++ subprojects/bahaghari/tests/lib/rgb.nix | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/subprojects/bahaghari/tests/lib/hex.nix b/subprojects/bahaghari/tests/lib/hex.nix index f685a54b..bd558ded 100644 --- a/subprojects/bahaghari/tests/lib/hex.nix +++ b/subprojects/bahaghari/tests/lib/hex.nix @@ -56,6 +56,11 @@ lib.runTests { expected = [ "A" "B" "C" "D" "E" "F" "10" "11" ]; }; + testCreateHexRange2 = { + expr = self.hex.range 64 76; + expected = [ "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" ]; + }; + testCreateHexWithHigherStart = { expr = self.hex.range 49 17; expected = [ ]; diff --git a/subprojects/bahaghari/tests/lib/rgb.nix b/subprojects/bahaghari/tests/lib/rgb.nix index ca9ee582..b1c2f3ab 100644 --- a/subprojects/bahaghari/tests/lib/rgb.nix +++ b/subprojects/bahaghari/tests/lib/rgb.nix @@ -96,6 +96,16 @@ in lib.runTests { expected = "173A69"; }; + testsToHex3 = { + expr = self.colors.rgb.toHex (RGB { + r = 23; + g = 58; + b = 105; + a = 21; + }); + expected = "173A69"; + }; + testsToHexVariant = { expr = self.colors.rgb.toHex' (RGB { r = 255;