{
  "version": 3,
  "group": "conversion",
  "description": "Deterministic conversion and precision fixtures. Numeric expected values represent unrounded internal math; formatted values represent the public display contract.",
  "defaultNumericTolerance": 1e-10,
  "cases": [
    {
      "id": "336699-full-color-model-conversion",
      "operation": "convertColor",
      "input": "#336699",
      "expected": {
        "hex": "#336699",
        "rgb": { "r": 51, "g": 102, "b": 153 },
        "hsl": { "h": 210, "s": 49.99999999999999, "l": 40 },
        "hsv": { "h": 210, "s": 66.66666666666666, "v": 60 },
        "hwb": { "h": 210, "w": 20, "b": 40 },
        "xyzD65": { "x": 0.11865530579242775, "y": 0.12505925609252708, "z": 0.31926610717393133 },
        "xyzD50": { "x": 0.11118745908211884, "y": 0.12192740396619164, "z": 0.24083403014953822 },
        "lab": { "l": 41.52082392740827, "a": -4.573089932636054, "b": -33.494194592438944 },
        "lch": { "l": 41.52082392740827, "c": 33.80494376460555, "h": 262.2252620788013 },
        "oklab": { "l": 0.49931445584520834, "a": -0.03304348760594705, "b": -0.09296659206477714 },
        "oklch": { "l": 0.49931445584520834, "c": 0.09866437712418327, "h": 250.4330574201754 }
      }
    },
    {
      "id": "336699-display-precision-contract",
      "operation": "formatColorSet",
      "input": "#336699",
      "expected": {
        "HEX": "#336699",
        "RGB": "rgb(51 102 153)",
        "HSL": "hsl(210 50% 40%)",
        "HSV": "hsv(210 66.67% 60%)",
        "HWB": "hwb(210 20% 40%)",
        "XYZ": "color(xyz-d65 0.118655 0.125059 0.319266)",
        "LAB": "lab(41.5208% -4.5731 -33.4942)",
        "LCH": "lch(41.5208% 33.8049 262.2253)",
        "OKLAB": "oklab(49.9314% -0.033043 -0.092967)",
        "OKLCH": "oklch(49.9314% 0.098664 250.4331)"
      },
      "precisionContract": "Formatting rounds a copy for display and never replaces the internal floating-point values used by calculations."
    },
    {
      "id": "short-alpha-hex-preserves-alpha",
      "operation": "convertColor",
      "input": "#0f08",
      "expected": {
        "hex": "#00FF00",
        "hexa": "#00FF0088",
        "alpha": 0.5333333333333333,
        "rgb": { "r": 0, "g": 255, "b": 0 },
        "rgba": { "r": 0, "g": 255, "b": 0, "a": 0.5333333333333333 }
      }
    },
    {
      "id": "parsed-color-object-preserves-unquantized-alpha",
      "operation": "convertColor",
      "input": { "hex": "#4169E1", "alpha": 0.1 },
      "expected": {
        "hex": "#4169E1",
        "hexa": "#4169E11A",
        "alpha": 0.1,
        "rgb": { "r": 65, "g": 105, "b": 225 },
        "rgba": { "r": 65, "g": 105, "b": 225, "a": 0.1 }
      },
      "precisionContract": "Parsed functional-color alpha remains exact internally; the 8-digit HEX representation is necessarily quantized to one byte."
    },
    {
      "id": "transparent-color-display-contract",
      "operation": "formatColorSet",
      "input": { "hex": "#4169E1", "alpha": 0.1 },
      "expected": {
        "HEX": "#4169E11A",
        "RGB": "rgb(65 105 225 / 0.1)",
        "HSL": "hsl(225 72.73% 56.86% / 0.1)",
        "HSV": "hsv(225 71.11% 88.24% / 0.1)",
        "HWB": "hwb(225 25.49% 11.76% / 0.1)",
        "XYZ": "color(xyz-d65 0.208204 0.166624 0.733555 / 0.1)",
        "LAB": "lab(46.8001% 17.7826 -66.6575 / 0.1)",
        "LCH": "lch(46.8001% 68.9887 284.9372 / 0.1)",
        "OKLAB": "oklab(55.9848% -0.011821 -0.187862 / 0.1)",
        "OKLCH": "oklch(55.9848% 0.188234 266.3996 / 0.1)"
      }
    },
    {
      "id": "xyz-d65-to-srgb-336699",
      "operation": "xyzToRgb",
      "input": { "x": 0.11865530579242775, "y": 0.12505925609252708, "z": 0.31926610717393133 },
      "expectedRgb": { "r": 51, "g": 102, "b": 153 },
      "rgbTolerance": 0.0001,
      "expectedHex": "#336699"
    },
    {
      "id": "srgb-round-trip-black",
      "operation": "hexRgbHexRoundTrip",
      "input": "#000000",
      "expectedHex": "#000000"
    },
    {
      "id": "srgb-round-trip-white",
      "operation": "hexRgbHexRoundTrip",
      "input": "#FFFFFF",
      "expectedHex": "#FFFFFF"
    },
    {
      "id": "srgb-round-trip-336699",
      "operation": "hexRgbHexRoundTrip",
      "input": "#336699",
      "expectedHex": "#336699"
    },
    {
      "id": "srgb-round-trip-lowercase-normalizes",
      "operation": "hexRgbHexRoundTrip",
      "input": "#ed1c24",
      "expectedHex": "#ED1C24"
    },
    {
      "id": "srgb-round-trip-channel-boundaries",
      "operation": "hexRgbHexRoundTrip",
      "input": "#00FF7F",
      "expectedHex": "#00FF7F"
    },
    {
      "id": "srgb-linear-round-trip-zero",
      "operation": "srgbLinearRoundTrip",
      "input": 0,
      "expected": 0,
      "numericTolerance": 1e-12
    },
    {
      "id": "srgb-linear-round-trip-below-transfer-knee",
      "operation": "srgbLinearRoundTrip",
      "input": 10,
      "expected": 10,
      "numericTolerance": 0
    },
    {
      "id": "srgb-linear-round-trip-above-transfer-knee",
      "operation": "srgbLinearRoundTrip",
      "input": 11,
      "expected": 11,
      "numericTolerance": 0
    },
    {
      "id": "srgb-linear-round-trip-midpoint",
      "operation": "srgbLinearRoundTrip",
      "input": 128,
      "expected": 128,
      "numericTolerance": 0
    },
    {
      "id": "srgb-linear-round-trip-maximum",
      "operation": "srgbLinearRoundTrip",
      "input": 255,
      "expected": 255,
      "numericTolerance": 0
    },
    {
      "id": "srgb-to-display-p3-black-equivalent",
      "operation": "rgbToDisplayP3",
      "input": { "r": 0, "g": 0, "b": 0 },
      "expected": { "r": 0, "g": 0, "b": 0 },
      "numericTolerance": 1e-12
    },
    {
      "id": "srgb-to-display-p3-white-equivalent",
      "operation": "rgbToDisplayP3",
      "input": { "r": 255, "g": 255, "b": 255 },
      "expected": { "r": 0.9999999999999999, "g": 0.9999999999999997, "b": 0.9999999999999999 },
      "numericTolerance": 1e-12
    },
    {
      "id": "srgb-to-display-p3-red-equivalent",
      "operation": "rgbToDisplayP3",
      "input": { "r": 255, "g": 0, "b": 0 },
      "expected": { "r": 0.9174875573251656, "g": 0.20028680774084695, "b": 0.13856059121111408 },
      "numericTolerance": 1e-12
    },
    {
      "id": "srgb-to-display-p3-royal-blue-equivalent",
      "operation": "rgbToDisplayP3",
      "input": { "r": 65, "g": 105, "b": 225 },
      "expected": { "r": 0.2903584040988726, "g": 0.4076999233833445, "b": 0.8525166865420485 },
      "numericTolerance": 1e-12
    },
    {
      "id": "display-p3-css-equivalent-with-alpha",
      "operation": "formatDisplayP3",
      "input": { "r": 65, "g": 105, "b": 225 },
      "alpha": 0.42,
      "places": 6,
      "expected": "color(display-p3 0.290358 0.4077 0.852517 / 0.42)"
    }
  ]
}
