defmodule Imagineer.Image.PNG.PngSuite.Compression.ZlibTest do
  use ExUnit.Case, async: true

  @test_path "test/support/images/pngsuite/compression/"

  @actual_pixels [
    [
      {255, 255, 0},
      {247, 255, 0},
      {239, 255, 0},
      {230, 255, 0},
      {222, 255, 0},
      {214, 255, 0},
      {206, 255, 0},
      {197, 255, 0},
      {189, 255, 0},
      {181, 255, 0},
      {173, 255, 0},
      {165, 255, 0},
      {156, 255, 0},
      {148, 255, 0},
      {140, 255, 0},
      {132, 255, 0},
      {123, 255, 0},
      {115, 255, 0},
      {107, 255, 0},
      {99, 255, 0},
      {90, 255, 0},
      {82, 255, 0},
      {74, 255, 0},
      {66, 255, 0},
      {58, 255, 0},
      {49, 255, 0},
      {41, 255, 0},
      {33, 255, 0},
      {25, 255, 0},
      {16, 255, 0},
      {8, 255, 0},
      {0, 255, 0}
    ],
    [
      {255, 247, 0},
      {247, 247, 0},
      {239, 247, 0},
      {230, 247, 0},
      {222, 247, 0},
      {214, 247, 0},
      {206, 247, 0},
      {197, 247, 0},
      {189, 247, 0},
      {181, 247, 0},
      {173, 247, 0},
      {165, 247, 0},
      {156, 247, 0},
      {148, 247, 0},
      {140, 247, 0},
      {132, 247, 0},
      {123, 247, 0},
      {115, 247, 0},
      {107, 247, 0},
      {99, 247, 0},
      {90, 247, 0},
      {82, 247, 0},
      {74, 247, 0},
      {66, 247, 0},
      {58, 247, 0},
      {49, 247, 0},
      {41, 247, 0},
      {33, 247, 0},
      {25, 247, 0},
      {16, 247, 0},
      {8, 247, 0},
      {0, 247, 8}
    ],
    [
      {255, 239, 0},
      {247, 239, 0},
      {239, 239, 0},
      {230, 239, 0},
      {222, 239, 0},
      {214, 239, 0},
      {206, 239, 0},
      {197, 239, 0},
      {189, 239, 0},
      {181, 239, 0},
      {173, 239, 0},
      {165, 239, 0},
      {156, 239, 0},
      {148, 239, 0},
      {140, 239, 0},
      {132, 239, 0},
      {123, 239, 0},
      {115, 239, 0},
      {107, 239, 0},
      {99, 239, 0},
      {90, 239, 0},
      {82, 239, 0},
      {74, 239, 0},
      {66, 239, 0},
      {58, 239, 0},
      {49, 239, 0},
      {41, 239, 0},
      {33, 239, 0},
      {25, 239, 0},
      {16, 239, 0},
      {8, 239, 8},
      {0, 239, 16}
    ],
    [
      {255, 230, 0},
      {247, 230, 0},
      {239, 230, 0},
      {230, 230, 0},
      {222, 230, 0},
      {214, 230, 0},
      {206, 230, 0},
      {197, 230, 0},
      {189, 230, 0},
      {181, 230, 0},
      {173, 230, 0},
      {165, 230, 0},
      {156, 230, 0},
      {148, 230, 0},
      {140, 230, 0},
      {132, 230, 0},
      {123, 230, 0},
      {115, 230, 0},
      {107, 230, 0},
      {99, 230, 0},
      {90, 230, 0},
      {82, 230, 0},
      {74, 230, 0},
      {66, 230, 0},
      {58, 230, 0},
      {49, 230, 0},
      {41, 230, 0},
      {33, 230, 0},
      {25, 230, 0},
      {16, 230, 8},
      {8, 230, 16},
      {0, 230, 25}
    ],
    [
      {255, 222, 0},
      {247, 222, 0},
      {239, 222, 0},
      {230, 222, 0},
      {222, 222, 0},
      {214, 222, 0},
      {206, 222, 0},
      {197, 222, 0},
      {189, 222, 0},
      {181, 222, 0},
      {173, 222, 0},
      {165, 222, 0},
      {156, 222, 0},
      {148, 222, 0},
      {140, 222, 0},
      {132, 222, 0},
      {123, 222, 0},
      {115, 222, 0},
      {107, 222, 0},
      {99, 222, 0},
      {90, 222, 0},
      {82, 222, 0},
      {74, 222, 0},
      {66, 222, 0},
      {58, 222, 0},
      {49, 222, 0},
      {41, 222, 0},
      {33, 222, 0},
      {25, 222, 8},
      {16, 222, 16},
      {8, 222, 25},
      {0, 222, 33}
    ],
    [
      {255, 214, 0},
      {247, 214, 0},
      {239, 214, 0},
      {230, 214, 0},
      {222, 214, 0},
      {214, 214, 0},
      {206, 214, 0},
      {197, 214, 0},
      {189, 214, 0},
      {181, 214, 0},
      {173, 214, 0},
      {165, 214, 0},
      {156, 214, 0},
      {148, 214, 0},
      {140, 214, 0},
      {132, 214, 0},
      {123, 214, 0},
      {115, 214, 0},
      {107, 214, 0},
      {99, 214, 0},
      {90, 214, 0},
      {82, 214, 0},
      {74, 214, 0},
      {66, 214, 0},
      {58, 214, 0},
      {49, 214, 0},
      {41, 214, 0},
      {33, 214, 8},
      {25, 214, 16},
      {16, 214, 25},
      {8, 214, 33},
      {0, 214, 41}
    ],
    [
      {255, 206, 0},
      {247, 206, 0},
      {239, 206, 0},
      {230, 206, 0},
      {222, 206, 0},
      {214, 206, 0},
      {206, 206, 0},
      {197, 206, 0},
      {189, 206, 0},
      {181, 206, 0},
      {173, 206, 0},
      {165, 206, 0},
      {156, 206, 0},
      {148, 206, 0},
      {140, 206, 0},
      {132, 206, 0},
      {123, 206, 0},
      {115, 206, 0},
      {107, 206, 0},
      {99, 206, 0},
      {90, 206, 0},
      {82, 206, 0},
      {74, 206, 0},
      {66, 206, 0},
      {58, 206, 0},
      {49, 206, 0},
      {41, 206, 8},
      {33, 206, 16},
      {25, 206, 25},
      {16, 206, 33},
      {8, 206, 41},
      {0, 206, 49}
    ],
    [
      {255, 197, 0},
      {247, 197, 0},
      {239, 197, 0},
      {230, 197, 0},
      {222, 197, 0},
      {214, 197, 0},
      {206, 197, 0},
      {197, 197, 0},
      {189, 197, 0},
      {181, 197, 0},
      {173, 197, 0},
      {165, 197, 0},
      {156, 197, 0},
      {148, 197, 0},
      {140, 197, 0},
      {132, 197, 0},
      {123, 197, 0},
      {115, 197, 0},
      {107, 197, 0},
      {99, 197, 0},
      {90, 197, 0},
      {82, 197, 0},
      {74, 197, 0},
      {66, 197, 0},
      {58, 197, 0},
      {49, 197, 8},
      {41, 197, 16},
      {33, 197, 25},
      {25, 197, 33},
      {16, 197, 41},
      {8, 197, 49},
      {0, 197, 58}
    ],
    [
      {255, 189, 0},
      {247, 189, 0},
      {239, 189, 0},
      {230, 189, 0},
      {222, 189, 0},
      {214, 189, 0},
      {206, 189, 0},
      {197, 189, 0},
      {189, 189, 0},
      {181, 189, 0},
      {173, 189, 0},
      {165, 189, 0},
      {156, 189, 0},
      {148, 189, 0},
      {140, 189, 0},
      {132, 189, 0},
      {123, 189, 0},
      {115, 189, 0},
      {107, 189, 0},
      {99, 189, 0},
      {90, 189, 0},
      {82, 189, 0},
      {74, 189, 0},
      {66, 189, 0},
      {58, 189, 8},
      {49, 189, 16},
      {41, 189, 25},
      {33, 189, 33},
      {25, 189, 41},
      {16, 189, 49},
      {8, 189, 58},
      {0, 189, 66}
    ],
    [
      {255, 181, 0},
      {247, 181, 0},
      {239, 181, 0},
      {230, 181, 0},
      {222, 181, 0},
      {214, 181, 0},
      {206, 181, 0},
      {197, 181, 0},
      {189, 181, 0},
      {181, 181, 0},
      {173, 181, 0},
      {165, 181, 0},
      {156, 181, 0},
      {148, 181, 0},
      {140, 181, 0},
      {132, 181, 0},
      {123, 181, 0},
      {115, 181, 0},
      {107, 181, 0},
      {99, 181, 0},
      {90, 181, 0},
      {82, 181, 0},
      {74, 181, 0},
      {66, 181, 8},
      {58, 181, 16},
      {49, 181, 25},
      {41, 181, 33},
      {33, 181, 41},
      {25, 181, 49},
      {16, 181, 58},
      {8, 181, 66},
      {0, 181, 74}
    ],
    [
      {255, 173, 0},
      {247, 173, 0},
      {239, 173, 0},
      {230, 173, 0},
      {222, 173, 0},
      {214, 173, 0},
      {206, 173, 0},
      {197, 173, 0},
      {189, 173, 0},
      {181, 173, 0},
      {173, 173, 0},
      {165, 173, 0},
      {156, 173, 0},
      {148, 173, 0},
      {140, 173, 0},
      {132, 173, 0},
      {123, 173, 0},
      {115, 173, 0},
      {107, 173, 0},
      {99, 173, 0},
      {90, 173, 0},
      {82, 173, 0},
      {74, 173, 8},
      {66, 173, 16},
      {58, 173, 25},
      {49, 173, 33},
      {41, 173, 41},
      {33, 173, 49},
      {25, 173, 58},
      {16, 173, 66},
      {8, 173, 74},
      {0, 173, 82}
    ],
    [
      {255, 165, 0},
      {247, 165, 0},
      {239, 165, 0},
      {230, 165, 0},
      {222, 165, 0},
      {214, 165, 0},
      {206, 165, 0},
      {197, 165, 0},
      {189, 165, 0},
      {181, 165, 0},
      {173, 165, 0},
      {165, 165, 0},
      {156, 165, 0},
      {148, 165, 0},
      {140, 165, 0},
      {132, 165, 0},
      {123, 165, 0},
      {115, 165, 0},
      {107, 165, 0},
      {99, 165, 0},
      {90, 165, 0},
      {82, 165, 8},
      {74, 165, 16},
      {66, 165, 25},
      {58, 165, 33},
      {49, 165, 41},
      {41, 165, 49},
      {33, 165, 58},
      {25, 165, 66},
      {16, 165, 74},
      {8, 165, 82},
      {0, 165, 90}
    ],
    [
      {255, 156, 0},
      {247, 156, 0},
      {239, 156, 0},
      {230, 156, 0},
      {222, 156, 0},
      {214, 156, 0},
      {206, 156, 0},
      {197, 156, 0},
      {189, 156, 0},
      {181, 156, 0},
      {173, 156, 0},
      {165, 156, 0},
      {156, 156, 0},
      {148, 156, 0},
      {140, 156, 0},
      {132, 156, 0},
      {123, 156, 0},
      {115, 156, 0},
      {107, 156, 0},
      {99, 156, 0},
      {90, 156, 8},
      {82, 156, 16},
      {74, 156, 25},
      {66, 156, 33},
      {58, 156, 41},
      {49, 156, 49},
      {41, 156, 58},
      {33, 156, 66},
      {25, 156, 74},
      {16, 156, 82},
      {8, 156, 90},
      {0, 156, 99}
    ],
    [
      {255, 148, 0},
      {247, 148, 0},
      {239, 148, 0},
      {230, 148, 0},
      {222, 148, 0},
      {214, 148, 0},
      {206, 148, 0},
      {197, 148, 0},
      {189, 148, 0},
      {181, 148, 0},
      {173, 148, 0},
      {165, 148, 0},
      {156, 148, 0},
      {148, 148, 0},
      {140, 148, 0},
      {132, 148, 0},
      {123, 148, 0},
      {115, 148, 0},
      {107, 148, 0},
      {99, 148, 8},
      {90, 148, 16},
      {82, 148, 25},
      {74, 148, 33},
      {66, 148, 41},
      {58, 148, 49},
      {49, 148, 58},
      {41, 148, 66},
      {33, 148, 74},
      {25, 148, 82},
      {16, 148, 90},
      {8, 148, 99},
      {0, 148, 107}
    ],
    [
      {255, 140, 0},
      {247, 140, 0},
      {239, 140, 0},
      {230, 140, 0},
      {222, 140, 0},
      {214, 140, 0},
      {206, 140, 0},
      {197, 140, 0},
      {189, 140, 0},
      {181, 140, 0},
      {173, 140, 0},
      {165, 140, 0},
      {156, 140, 0},
      {148, 140, 0},
      {140, 140, 0},
      {132, 140, 0},
      {123, 140, 0},
      {115, 140, 0},
      {107, 140, 8},
      {99, 140, 16},
      {90, 140, 25},
      {82, 140, 33},
      {74, 140, 41},
      {66, 140, 49},
      {58, 140, 58},
      {49, 140, 66},
      {41, 140, 74},
      {33, 140, 82},
      {25, 140, 90},
      {16, 140, 99},
      {8, 140, 107},
      {0, 140, 115}
    ],
    [
      {255, 132, 0},
      {247, 132, 0},
      {239, 132, 0},
      {230, 132, 0},
      {222, 132, 0},
      {214, 132, 0},
      {206, 132, 0},
      {197, 132, 0},
      {189, 132, 0},
      {181, 132, 0},
      {173, 132, 0},
      {165, 132, 0},
      {156, 132, 0},
      {148, 132, 0},
      {140, 132, 0},
      {132, 132, 0},
      {123, 132, 0},
      {115, 132, 8},
      {107, 132, 16},
      {99, 132, 25},
      {90, 132, 33},
      {82, 132, 41},
      {74, 132, 49},
      {66, 132, 58},
      {58, 132, 66},
      {49, 132, 74},
      {41, 132, 82},
      {33, 132, 90},
      {25, 132, 99},
      {16, 132, 107},
      {8, 132, 115},
      {0, 132, 123}
    ],
    [
      {255, 123, 0},
      {247, 123, 0},
      {239, 123, 0},
      {230, 123, 0},
      {222, 123, 0},
      {214, 123, 0},
      {206, 123, 0},
      {197, 123, 0},
      {189, 123, 0},
      {181, 123, 0},
      {173, 123, 0},
      {165, 123, 0},
      {156, 123, 0},
      {148, 123, 0},
      {140, 123, 0},
      {132, 123, 0},
      {123, 123, 8},
      {115, 123, 16},
      {107, 123, 25},
      {99, 123, 33},
      {90, 123, 41},
      {82, 123, 49},
      {74, 123, 58},
      {66, 123, 66},
      {58, 123, 74},
      {49, 123, 82},
      {41, 123, 90},
      {33, 123, 99},
      {25, 123, 107},
      {16, 123, 115},
      {8, 123, 123},
      {0, 123, 132}
    ],
    [
      {255, 115, 0},
      {247, 115, 0},
      {239, 115, 0},
      {230, 115, 0},
      {222, 115, 0},
      {214, 115, 0},
      {206, 115, 0},
      {197, 115, 0},
      {189, 115, 0},
      {181, 115, 0},
      {173, 115, 0},
      {165, 115, 0},
      {156, 115, 0},
      {148, 115, 0},
      {140, 115, 0},
      {132, 115, 8},
      {123, 115, 16},
      {115, 115, 25},
      {107, 115, 33},
      {99, 115, 41},
      {90, 115, 49},
      {82, 115, 58},
      {74, 115, 66},
      {66, 115, 74},
      {58, 115, 82},
      {49, 115, 90},
      {41, 115, 99},
      {33, 115, 107},
      {25, 115, 115},
      {16, 115, 123},
      {8, 115, 132},
      {0, 115, 140}
    ],
    [
      {255, 107, 0},
      {247, 107, 0},
      {239, 107, 0},
      {230, 107, 0},
      {222, 107, 0},
      {214, 107, 0},
      {206, 107, 0},
      {197, 107, 0},
      {189, 107, 0},
      {181, 107, 0},
      {173, 107, 0},
      {165, 107, 0},
      {156, 107, 0},
      {148, 107, 0},
      {140, 107, 8},
      {132, 107, 16},
      {123, 107, 25},
      {115, 107, 33},
      {107, 107, 41},
      {99, 107, 49},
      {90, 107, 58},
      {82, 107, 66},
      {74, 107, 74},
      {66, 107, 82},
      {58, 107, 90},
      {49, 107, 99},
      {41, 107, 107},
      {33, 107, 115},
      {25, 107, 123},
      {16, 107, 132},
      {8, 107, 140},
      {0, 107, 148}
    ],
    [
      {255, 99, 0},
      {247, 99, 0},
      {239, 99, 0},
      {230, 99, 0},
      {222, 99, 0},
      {214, 99, 0},
      {206, 99, 0},
      {197, 99, 0},
      {189, 99, 0},
      {181, 99, 0},
      {173, 99, 0},
      {165, 99, 0},
      {156, 99, 0},
      {148, 99, 8},
      {140, 99, 16},
      {132, 99, 25},
      {123, 99, 33},
      {115, 99, 41},
      {107, 99, 49},
      {99, 99, 58},
      {90, 99, 66},
      {82, 99, 74},
      {74, 99, 82},
      {66, 99, 90},
      {58, 99, 99},
      {49, 99, 107},
      {41, 99, 115},
      {33, 99, 123},
      {25, 99, 132},
      {16, 99, 140},
      {8, 99, 148},
      {0, 99, 156}
    ],
    [
      {255, 90, 0},
      {247, 90, 0},
      {239, 90, 0},
      {230, 90, 0},
      {222, 90, 0},
      {214, 90, 0},
      {206, 90, 0},
      {197, 90, 0},
      {189, 90, 0},
      {181, 90, 0},
      {173, 90, 0},
      {165, 90, 0},
      {156, 90, 8},
      {148, 90, 16},
      {140, 90, 25},
      {132, 90, 33},
      {123, 90, 41},
      {115, 90, 49},
      {107, 90, 58},
      {99, 90, 66},
      {90, 90, 74},
      {82, 90, 82},
      {74, 90, 90},
      {66, 90, 99},
      {58, 90, 107},
      {49, 90, 115},
      {41, 90, 123},
      {33, 90, 132},
      {25, 90, 140},
      {16, 90, 148},
      {8, 90, 156},
      {0, 90, 165}
    ],
    [
      {255, 82, 0},
      {247, 82, 0},
      {239, 82, 0},
      {230, 82, 0},
      {222, 82, 0},
      {214, 82, 0},
      {206, 82, 0},
      {197, 82, 0},
      {189, 82, 0},
      {181, 82, 0},
      {173, 82, 0},
      {165, 82, 8},
      {156, 82, 16},
      {148, 82, 25},
      {140, 82, 33},
      {132, 82, 41},
      {123, 82, 49},
      {115, 82, 58},
      {107, 82, 66},
      {99, 82, 74},
      {90, 82, 82},
      {82, 82, 90},
      {74, 82, 99},
      {66, 82, 107},
      {58, 82, 115},
      {49, 82, 123},
      {41, 82, 132},
      {33, 82, 140},
      {25, 82, 148},
      {16, 82, 156},
      {8, 82, 165},
      {0, 82, 173}
    ],
    [
      {255, 74, 0},
      {247, 74, 0},
      {239, 74, 0},
      {230, 74, 0},
      {222, 74, 0},
      {214, 74, 0},
      {206, 74, 0},
      {197, 74, 0},
      {189, 74, 0},
      {181, 74, 0},
      {173, 74, 8},
      {165, 74, 16},
      {156, 74, 25},
      {148, 74, 33},
      {140, 74, 41},
      {132, 74, 49},
      {123, 74, 58},
      {115, 74, 66},
      {107, 74, 74},
      {99, 74, 82},
      {90, 74, 90},
      {82, 74, 99},
      {74, 74, 107},
      {66, 74, 115},
      {58, 74, 123},
      {49, 74, 132},
      {41, 74, 140},
      {33, 74, 148},
      {25, 74, 156},
      {16, 74, 165},
      {8, 74, 173},
      {0, 74, 181}
    ],
    [
      {255, 66, 0},
      {247, 66, 0},
      {239, 66, 0},
      {230, 66, 0},
      {222, 66, 0},
      {214, 66, 0},
      {206, 66, 0},
      {197, 66, 0},
      {189, 66, 0},
      {181, 66, 8},
      {173, 66, 16},
      {165, 66, 25},
      {156, 66, 33},
      {148, 66, 41},
      {140, 66, 49},
      {132, 66, 58},
      {123, 66, 66},
      {115, 66, 74},
      {107, 66, 82},
      {99, 66, 90},
      {90, 66, 99},
      {82, 66, 107},
      {74, 66, 115},
      {66, 66, 123},
      {58, 66, 132},
      {49, 66, 140},
      {41, 66, 148},
      {33, 66, 156},
      {25, 66, 165},
      {16, 66, 173},
      {8, 66, 181},
      {0, 66, 189}
    ],
    [
      {255, 58, 0},
      {247, 58, 0},
      {239, 58, 0},
      {230, 58, 0},
      {222, 58, 0},
      {214, 58, 0},
      {206, 58, 0},
      {197, 58, 0},
      {189, 58, 8},
      {181, 58, 16},
      {173, 58, 25},
      {165, 58, 33},
      {156, 58, 41},
      {148, 58, 49},
      {140, 58, 58},
      {132, 58, 66},
      {123, 58, 74},
      {115, 58, 82},
      {107, 58, 90},
      {99, 58, 99},
      {90, 58, 107},
      {82, 58, 115},
      {74, 58, 123},
      {66, 58, 132},
      {58, 58, 140},
      {49, 58, 148},
      {41, 58, 156},
      {33, 58, 165},
      {25, 58, 173},
      {16, 58, 181},
      {8, 58, 189},
      {0, 58, 197}
    ],
    [
      {255, 49, 0},
      {247, 49, 0},
      {239, 49, 0},
      {230, 49, 0},
      {222, 49, 0},
      {214, 49, 0},
      {206, 49, 0},
      {197, 49, 8},
      {189, 49, 16},
      {181, 49, 25},
      {173, 49, 33},
      {165, 49, 41},
      {156, 49, 49},
      {148, 49, 58},
      {140, 49, 66},
      {132, 49, 74},
      {123, 49, 82},
      {115, 49, 90},
      {107, 49, 99},
      {99, 49, 107},
      {90, 49, 115},
      {82, 49, 123},
      {74, 49, 132},
      {66, 49, 140},
      {58, 49, 148},
      {49, 49, 156},
      {41, 49, 165},
      {33, 49, 173},
      {25, 49, 181},
      {16, 49, 189},
      {8, 49, 197},
      {0, 49, 206}
    ],
    [
      {255, 41, 0},
      {247, 41, 0},
      {239, 41, 0},
      {230, 41, 0},
      {222, 41, 0},
      {214, 41, 0},
      {206, 41, 8},
      {197, 41, 16},
      {189, 41, 25},
      {181, 41, 33},
      {173, 41, 41},
      {165, 41, 49},
      {156, 41, 58},
      {148, 41, 66},
      {140, 41, 74},
      {132, 41, 82},
      {123, 41, 90},
      {115, 41, 99},
      {107, 41, 107},
      {99, 41, 115},
      {90, 41, 123},
      {82, 41, 132},
      {74, 41, 140},
      {66, 41, 148},
      {58, 41, 156},
      {49, 41, 165},
      {41, 41, 173},
      {33, 41, 181},
      {25, 41, 189},
      {16, 41, 197},
      {8, 41, 206},
      {0, 41, 214}
    ],
    [
      {255, 33, 0},
      {247, 33, 0},
      {239, 33, 0},
      {230, 33, 0},
      {222, 33, 0},
      {214, 33, 8},
      {206, 33, 16},
      {197, 33, 25},
      {189, 33, 33},
      {181, 33, 41},
      {173, 33, 49},
      {165, 33, 58},
      {156, 33, 66},
      {148, 33, 74},
      {140, 33, 82},
      {132, 33, 90},
      {123, 33, 99},
      {115, 33, 107},
      {107, 33, 115},
      {99, 33, 123},
      {90, 33, 132},
      {82, 33, 140},
      {74, 33, 148},
      {66, 33, 156},
      {58, 33, 165},
      {49, 33, 173},
      {41, 33, 181},
      {33, 33, 189},
      {25, 33, 197},
      {16, 33, 206},
      {8, 33, 214},
      {0, 33, 222}
    ],
    [
      {255, 25, 0},
      {247, 25, 0},
      {239, 25, 0},
      {230, 25, 0},
      {222, 25, 8},
      {214, 25, 16},
      {206, 25, 25},
      {197, 25, 33},
      {189, 25, 41},
      {181, 25, 49},
      {173, 25, 58},
      {165, 25, 66},
      {156, 25, 74},
      {148, 25, 82},
      {140, 25, 90},
      {132, 25, 99},
      {123, 25, 107},
      {115, 25, 115},
      {107, 25, 123},
      {99, 25, 132},
      {90, 25, 140},
      {82, 25, 148},
      {74, 25, 156},
      {66, 25, 165},
      {58, 25, 173},
      {49, 25, 181},
      {41, 25, 189},
      {33, 25, 197},
      {25, 25, 206},
      {16, 25, 214},
      {8, 25, 222},
      {0, 25, 230}
    ],
    [
      {255, 16, 0},
      {247, 16, 0},
      {239, 16, 0},
      {230, 16, 8},
      {222, 16, 16},
      {214, 16, 25},
      {206, 16, 33},
      {197, 16, 41},
      {189, 16, 49},
      {181, 16, 58},
      {173, 16, 66},
      {165, 16, 74},
      {156, 16, 82},
      {148, 16, 90},
      {140, 16, 99},
      {132, 16, 107},
      {123, 16, 115},
      {115, 16, 123},
      {107, 16, 132},
      {99, 16, 140},
      {90, 16, 148},
      {82, 16, 156},
      {74, 16, 165},
      {66, 16, 173},
      {58, 16, 181},
      {49, 16, 189},
      {41, 16, 197},
      {33, 16, 206},
      {25, 16, 214},
      {16, 16, 222},
      {8, 16, 230},
      {0, 16, 239}
    ],
    [
      {255, 8, 0},
      {247, 8, 0},
      {239, 8, 8},
      {230, 8, 16},
      {222, 8, 25},
      {214, 8, 33},
      {206, 8, 41},
      {197, 8, 49},
      {189, 8, 58},
      {181, 8, 66},
      {173, 8, 74},
      {165, 8, 82},
      {156, 8, 90},
      {148, 8, 99},
      {140, 8, 107},
      {132, 8, 115},
      {123, 8, 123},
      {115, 8, 132},
      {107, 8, 140},
      {99, 8, 148},
      {90, 8, 156},
      {82, 8, 165},
      {74, 8, 173},
      {66, 8, 181},
      {58, 8, 189},
      {49, 8, 197},
      {41, 8, 206},
      {33, 8, 214},
      {25, 8, 222},
      {16, 8, 230},
      {8, 8, 239},
      {0, 8, 247}
    ],
    [
      {255, 0, 0},
      {247, 0, 8},
      {239, 0, 16},
      {230, 0, 25},
      {222, 0, 33},
      {214, 0, 41},
      {206, 0, 49},
      {197, 0, 58},
      {189, 0, 66},
      {181, 0, 74},
      {173, 0, 82},
      {165, 0, 90},
      {156, 0, 99},
      {148, 0, 107},
      {140, 0, 115},
      {132, 0, 123},
      {123, 0, 132},
      {115, 0, 140},
      {107, 0, 148},
      {99, 0, 156},
      {90, 0, 165},
      {82, 0, 173},
      {74, 0, 181},
      {66, 0, 189},
      {58, 0, 197},
      {49, 0, 206},
      {41, 0, 214},
      {33, 0, 222},
      {25, 0, 230},
      {16, 0, 239},
      {8, 0, 247},
      {0, 0, 255}
    ]
  ]
  test "zlib level 0 (no compression)" do
    {:ok, image} = Imagineer.load(@test_path <> "z00n2c08.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb
    assert image.compression == :zlib
    assert image.color_type == 2
    assert image.interlace_method == 0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)
  end

  test "zlib level 3" do
    {:ok, image} = Imagineer.load(@test_path <> "z03n2c08.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb
    assert image.compression == :zlib
    assert image.color_type == 2
    assert image.interlace_method == 0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)
  end

  test "zlib level 6" do
    {:ok, image} = Imagineer.load(@test_path <> "z06n2c08.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb
    assert image.compression == :zlib
    assert image.color_type == 2
    assert image.interlace_method == 0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)
  end

  test "zlib level 9 (highest!)" do
    {:ok, image} = Imagineer.load(@test_path <> "z09n2c08.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb
    assert image.compression == :zlib
    assert image.color_type == 2
    assert image.interlace_method == 0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)
  end

  defp assert_pixels_match(parsed_pixels, actual_pixels) do
    Enum.zip(parsed_pixels, actual_pixels)
    |> Enum.with_index()
    |> Enum.each(fn
      {{parsed, actual}, index} ->
        assert(actual == parsed, """
          row #{index + 1} is fucked
          \texpected: #{inspect(actual)}
          \tgot: #{inspect(parsed)}
        """)
    end)
  end
end
