defmodule Imagineer.Image.PNG.PngSuite.Ordering.ChunkOrderingTest do
  use ExUnit.Case, async: true

  @test_path "test/support/images/pngsuite/ordering/"
  @rgb_pixels [
    [
      {65535, 65535, 0},
      {63421, 65535, 0},
      {61307, 65535, 0},
      {59193, 65535, 0},
      {57079, 65535, 0},
      {54965, 65535, 0},
      {52851, 65535, 0},
      {50737, 65535, 0},
      {48623, 65535, 0},
      {46509, 65535, 0},
      {44395, 65535, 0},
      {42281, 65535, 0},
      {40167, 65535, 0},
      {38053, 65535, 0},
      {35939, 65535, 0},
      {33825, 65535, 0},
      {31710, 65535, 0},
      {29596, 65535, 0},
      {27482, 65535, 0},
      {25368, 65535, 0},
      {23254, 65535, 0},
      {21140, 65535, 0},
      {19026, 65535, 0},
      {16912, 65535, 0},
      {14798, 65535, 0},
      {12684, 65535, 0},
      {10570, 65535, 0},
      {8456, 65535, 0},
      {6342, 65535, 0},
      {4228, 65535, 0},
      {2114, 65535, 0},
      {0, 65535, 0}
    ],
    [
      {65535, 63421, 0},
      {63421, 63421, 0},
      {61307, 63421, 0},
      {59193, 63421, 0},
      {57079, 63421, 0},
      {54965, 63421, 0},
      {52851, 63421, 0},
      {50737, 63421, 0},
      {48623, 63421, 0},
      {46509, 63421, 0},
      {44395, 63421, 0},
      {42281, 63421, 0},
      {40167, 63421, 0},
      {38053, 63421, 0},
      {35939, 63421, 0},
      {33825, 63421, 0},
      {31710, 63421, 0},
      {29596, 63421, 0},
      {27482, 63421, 0},
      {25368, 63421, 0},
      {23254, 63421, 0},
      {21140, 63421, 0},
      {19026, 63421, 0},
      {16912, 63421, 0},
      {14798, 63421, 0},
      {12684, 63421, 0},
      {10570, 63421, 0},
      {8456, 63421, 0},
      {6342, 63421, 0},
      {4228, 63421, 0},
      {2114, 63421, 0},
      {0, 63421, 2114}
    ],
    [
      {65535, 61307, 0},
      {63421, 61307, 0},
      {61307, 61307, 0},
      {59193, 61307, 0},
      {57079, 61307, 0},
      {54965, 61307, 0},
      {52851, 61307, 0},
      {50737, 61307, 0},
      {48623, 61307, 0},
      {46509, 61307, 0},
      {44395, 61307, 0},
      {42281, 61307, 0},
      {40167, 61307, 0},
      {38053, 61307, 0},
      {35939, 61307, 0},
      {33825, 61307, 0},
      {31710, 61307, 0},
      {29596, 61307, 0},
      {27482, 61307, 0},
      {25368, 61307, 0},
      {23254, 61307, 0},
      {21140, 61307, 0},
      {19026, 61307, 0},
      {16912, 61307, 0},
      {14798, 61307, 0},
      {12684, 61307, 0},
      {10570, 61307, 0},
      {8456, 61307, 0},
      {6342, 61307, 0},
      {4228, 61307, 0},
      {2114, 61307, 2114},
      {0, 61307, 4228}
    ],
    [
      {65535, 59193, 0},
      {63421, 59193, 0},
      {61307, 59193, 0},
      {59193, 59193, 0},
      {57079, 59193, 0},
      {54965, 59193, 0},
      {52851, 59193, 0},
      {50737, 59193, 0},
      {48623, 59193, 0},
      {46509, 59193, 0},
      {44395, 59193, 0},
      {42281, 59193, 0},
      {40167, 59193, 0},
      {38053, 59193, 0},
      {35939, 59193, 0},
      {33825, 59193, 0},
      {31710, 59193, 0},
      {29596, 59193, 0},
      {27482, 59193, 0},
      {25368, 59193, 0},
      {23254, 59193, 0},
      {21140, 59193, 0},
      {19026, 59193, 0},
      {16912, 59193, 0},
      {14798, 59193, 0},
      {12684, 59193, 0},
      {10570, 59193, 0},
      {8456, 59193, 0},
      {6342, 59193, 0},
      {4228, 59193, 2114},
      {2114, 59193, 4228},
      {0, 59193, 6342}
    ],
    [
      {65535, 57079, 0},
      {63421, 57079, 0},
      {61307, 57079, 0},
      {59193, 57079, 0},
      {57079, 57079, 0},
      {54965, 57079, 0},
      {52851, 57079, 0},
      {50737, 57079, 0},
      {48623, 57079, 0},
      {46509, 57079, 0},
      {44395, 57079, 0},
      {42281, 57079, 0},
      {40167, 57079, 0},
      {38053, 57079, 0},
      {35939, 57079, 0},
      {33825, 57079, 0},
      {31710, 57079, 0},
      {29596, 57079, 0},
      {27482, 57079, 0},
      {25368, 57079, 0},
      {23254, 57079, 0},
      {21140, 57079, 0},
      {19026, 57079, 0},
      {16912, 57079, 0},
      {14798, 57079, 0},
      {12684, 57079, 0},
      {10570, 57079, 0},
      {8456, 57079, 0},
      {6342, 57079, 2114},
      {4228, 57079, 4228},
      {2114, 57079, 6342},
      {0, 57079, 8456}
    ],
    [
      {65535, 54965, 0},
      {63421, 54965, 0},
      {61307, 54965, 0},
      {59193, 54965, 0},
      {57079, 54965, 0},
      {54965, 54965, 0},
      {52851, 54965, 0},
      {50737, 54965, 0},
      {48623, 54965, 0},
      {46509, 54965, 0},
      {44395, 54965, 0},
      {42281, 54965, 0},
      {40167, 54965, 0},
      {38053, 54965, 0},
      {35939, 54965, 0},
      {33825, 54965, 0},
      {31710, 54965, 0},
      {29596, 54965, 0},
      {27482, 54965, 0},
      {25368, 54965, 0},
      {23254, 54965, 0},
      {21140, 54965, 0},
      {19026, 54965, 0},
      {16912, 54965, 0},
      {14798, 54965, 0},
      {12684, 54965, 0},
      {10570, 54965, 0},
      {8456, 54965, 2114},
      {6342, 54965, 4228},
      {4228, 54965, 6342},
      {2114, 54965, 8456},
      {0, 54965, 10570}
    ],
    [
      {65535, 52851, 0},
      {63421, 52851, 0},
      {61307, 52851, 0},
      {59193, 52851, 0},
      {57079, 52851, 0},
      {54965, 52851, 0},
      {52851, 52851, 0},
      {50737, 52851, 0},
      {48623, 52851, 0},
      {46509, 52851, 0},
      {44395, 52851, 0},
      {42281, 52851, 0},
      {40167, 52851, 0},
      {38053, 52851, 0},
      {35939, 52851, 0},
      {33825, 52851, 0},
      {31710, 52851, 0},
      {29596, 52851, 0},
      {27482, 52851, 0},
      {25368, 52851, 0},
      {23254, 52851, 0},
      {21140, 52851, 0},
      {19026, 52851, 0},
      {16912, 52851, 0},
      {14798, 52851, 0},
      {12684, 52851, 0},
      {10570, 52851, 2114},
      {8456, 52851, 4228},
      {6342, 52851, 6342},
      {4228, 52851, 8456},
      {2114, 52851, 10570},
      {0, 52851, 12684}
    ],
    [
      {65535, 50737, 0},
      {63421, 50737, 0},
      {61307, 50737, 0},
      {59193, 50737, 0},
      {57079, 50737, 0},
      {54965, 50737, 0},
      {52851, 50737, 0},
      {50737, 50737, 0},
      {48623, 50737, 0},
      {46509, 50737, 0},
      {44395, 50737, 0},
      {42281, 50737, 0},
      {40167, 50737, 0},
      {38053, 50737, 0},
      {35939, 50737, 0},
      {33825, 50737, 0},
      {31710, 50737, 0},
      {29596, 50737, 0},
      {27482, 50737, 0},
      {25368, 50737, 0},
      {23254, 50737, 0},
      {21140, 50737, 0},
      {19026, 50737, 0},
      {16912, 50737, 0},
      {14798, 50737, 0},
      {12684, 50737, 2114},
      {10570, 50737, 4228},
      {8456, 50737, 6342},
      {6342, 50737, 8456},
      {4228, 50737, 10570},
      {2114, 50737, 12684},
      {0, 50737, 14798}
    ],
    [
      {65535, 48623, 0},
      {63421, 48623, 0},
      {61307, 48623, 0},
      {59193, 48623, 0},
      {57079, 48623, 0},
      {54965, 48623, 0},
      {52851, 48623, 0},
      {50737, 48623, 0},
      {48623, 48623, 0},
      {46509, 48623, 0},
      {44395, 48623, 0},
      {42281, 48623, 0},
      {40167, 48623, 0},
      {38053, 48623, 0},
      {35939, 48623, 0},
      {33825, 48623, 0},
      {31710, 48623, 0},
      {29596, 48623, 0},
      {27482, 48623, 0},
      {25368, 48623, 0},
      {23254, 48623, 0},
      {21140, 48623, 0},
      {19026, 48623, 0},
      {16912, 48623, 0},
      {14798, 48623, 2114},
      {12684, 48623, 4228},
      {10570, 48623, 6342},
      {8456, 48623, 8456},
      {6342, 48623, 10570},
      {4228, 48623, 12684},
      {2114, 48623, 14798},
      {0, 48623, 16912}
    ],
    [
      {65535, 46509, 0},
      {63421, 46509, 0},
      {61307, 46509, 0},
      {59193, 46509, 0},
      {57079, 46509, 0},
      {54965, 46509, 0},
      {52851, 46509, 0},
      {50737, 46509, 0},
      {48623, 46509, 0},
      {46509, 46509, 0},
      {44395, 46509, 0},
      {42281, 46509, 0},
      {40167, 46509, 0},
      {38053, 46509, 0},
      {35939, 46509, 0},
      {33825, 46509, 0},
      {31710, 46509, 0},
      {29596, 46509, 0},
      {27482, 46509, 0},
      {25368, 46509, 0},
      {23254, 46509, 0},
      {21140, 46509, 0},
      {19026, 46509, 0},
      {16912, 46509, 2114},
      {14798, 46509, 4228},
      {12684, 46509, 6342},
      {10570, 46509, 8456},
      {8456, 46509, 10570},
      {6342, 46509, 12684},
      {4228, 46509, 14798},
      {2114, 46509, 16912},
      {0, 46509, 19026}
    ],
    [
      {65535, 44395, 0},
      {63421, 44395, 0},
      {61307, 44395, 0},
      {59193, 44395, 0},
      {57079, 44395, 0},
      {54965, 44395, 0},
      {52851, 44395, 0},
      {50737, 44395, 0},
      {48623, 44395, 0},
      {46509, 44395, 0},
      {44395, 44395, 0},
      {42281, 44395, 0},
      {40167, 44395, 0},
      {38053, 44395, 0},
      {35939, 44395, 0},
      {33825, 44395, 0},
      {31710, 44395, 0},
      {29596, 44395, 0},
      {27482, 44395, 0},
      {25368, 44395, 0},
      {23254, 44395, 0},
      {21140, 44395, 0},
      {19026, 44395, 2114},
      {16912, 44395, 4228},
      {14798, 44395, 6342},
      {12684, 44395, 8456},
      {10570, 44395, 10570},
      {8456, 44395, 12684},
      {6342, 44395, 14798},
      {4228, 44395, 16912},
      {2114, 44395, 19026},
      {0, 44395, 21140}
    ],
    [
      {65535, 42281, 0},
      {63421, 42281, 0},
      {61307, 42281, 0},
      {59193, 42281, 0},
      {57079, 42281, 0},
      {54965, 42281, 0},
      {52851, 42281, 0},
      {50737, 42281, 0},
      {48623, 42281, 0},
      {46509, 42281, 0},
      {44395, 42281, 0},
      {42281, 42281, 0},
      {40167, 42281, 0},
      {38053, 42281, 0},
      {35939, 42281, 0},
      {33825, 42281, 0},
      {31710, 42281, 0},
      {29596, 42281, 0},
      {27482, 42281, 0},
      {25368, 42281, 0},
      {23254, 42281, 0},
      {21140, 42281, 2114},
      {19026, 42281, 4228},
      {16912, 42281, 6342},
      {14798, 42281, 8456},
      {12684, 42281, 10570},
      {10570, 42281, 12684},
      {8456, 42281, 14798},
      {6342, 42281, 16912},
      {4228, 42281, 19026},
      {2114, 42281, 21140},
      {0, 42281, 23254}
    ],
    [
      {65535, 40167, 0},
      {63421, 40167, 0},
      {61307, 40167, 0},
      {59193, 40167, 0},
      {57079, 40167, 0},
      {54965, 40167, 0},
      {52851, 40167, 0},
      {50737, 40167, 0},
      {48623, 40167, 0},
      {46509, 40167, 0},
      {44395, 40167, 0},
      {42281, 40167, 0},
      {40167, 40167, 0},
      {38053, 40167, 0},
      {35939, 40167, 0},
      {33825, 40167, 0},
      {31710, 40167, 0},
      {29596, 40167, 0},
      {27482, 40167, 0},
      {25368, 40167, 0},
      {23254, 40167, 2114},
      {21140, 40167, 4228},
      {19026, 40167, 6342},
      {16912, 40167, 8456},
      {14798, 40167, 10570},
      {12684, 40167, 12684},
      {10570, 40167, 14798},
      {8456, 40167, 16912},
      {6342, 40167, 19026},
      {4228, 40167, 21140},
      {2114, 40167, 23254},
      {0, 40167, 25368}
    ],
    [
      {65535, 38053, 0},
      {63421, 38053, 0},
      {61307, 38053, 0},
      {59193, 38053, 0},
      {57079, 38053, 0},
      {54965, 38053, 0},
      {52851, 38053, 0},
      {50737, 38053, 0},
      {48623, 38053, 0},
      {46509, 38053, 0},
      {44395, 38053, 0},
      {42281, 38053, 0},
      {40167, 38053, 0},
      {38053, 38053, 0},
      {35939, 38053, 0},
      {33825, 38053, 0},
      {31710, 38053, 0},
      {29596, 38053, 0},
      {27482, 38053, 0},
      {25368, 38053, 2114},
      {23254, 38053, 4228},
      {21140, 38053, 6342},
      {19026, 38053, 8456},
      {16912, 38053, 10570},
      {14798, 38053, 12684},
      {12684, 38053, 14798},
      {10570, 38053, 16912},
      {8456, 38053, 19026},
      {6342, 38053, 21140},
      {4228, 38053, 23254},
      {2114, 38053, 25368},
      {0, 38053, 27482}
    ],
    [
      {65535, 35939, 0},
      {63421, 35939, 0},
      {61307, 35939, 0},
      {59193, 35939, 0},
      {57079, 35939, 0},
      {54965, 35939, 0},
      {52851, 35939, 0},
      {50737, 35939, 0},
      {48623, 35939, 0},
      {46509, 35939, 0},
      {44395, 35939, 0},
      {42281, 35939, 0},
      {40167, 35939, 0},
      {38053, 35939, 0},
      {35939, 35939, 0},
      {33825, 35939, 0},
      {31710, 35939, 0},
      {29596, 35939, 0},
      {27482, 35939, 2114},
      {25368, 35939, 4228},
      {23254, 35939, 6342},
      {21140, 35939, 8456},
      {19026, 35939, 10570},
      {16912, 35939, 12684},
      {14798, 35939, 14798},
      {12684, 35939, 16912},
      {10570, 35939, 19026},
      {8456, 35939, 21140},
      {6342, 35939, 23254},
      {4228, 35939, 25368},
      {2114, 35939, 27482},
      {0, 35939, 29596}
    ],
    [
      {65535, 33825, 0},
      {63421, 33825, 0},
      {61307, 33825, 0},
      {59193, 33825, 0},
      {57079, 33825, 0},
      {54965, 33825, 0},
      {52851, 33825, 0},
      {50737, 33825, 0},
      {48623, 33825, 0},
      {46509, 33825, 0},
      {44395, 33825, 0},
      {42281, 33825, 0},
      {40167, 33825, 0},
      {38053, 33825, 0},
      {35939, 33825, 0},
      {33825, 33825, 0},
      {31710, 33825, 0},
      {29596, 33825, 2114},
      {27482, 33825, 4228},
      {25368, 33825, 6342},
      {23254, 33825, 8456},
      {21140, 33825, 10570},
      {19026, 33825, 12684},
      {16912, 33825, 14798},
      {14798, 33825, 16912},
      {12684, 33825, 19026},
      {10570, 33825, 21140},
      {8456, 33825, 23254},
      {6342, 33825, 25368},
      {4228, 33825, 27482},
      {2114, 33825, 29596},
      {0, 33825, 31710}
    ],
    [
      {65535, 31710, 0},
      {63421, 31710, 0},
      {61307, 31710, 0},
      {59193, 31710, 0},
      {57079, 31710, 0},
      {54965, 31710, 0},
      {52851, 31710, 0},
      {50737, 31710, 0},
      {48623, 31710, 0},
      {46509, 31710, 0},
      {44395, 31710, 0},
      {42281, 31710, 0},
      {40167, 31710, 0},
      {38053, 31710, 0},
      {35939, 31710, 0},
      {33825, 31710, 0},
      {31710, 31710, 2114},
      {29596, 31710, 4228},
      {27482, 31710, 6342},
      {25368, 31710, 8456},
      {23254, 31710, 10570},
      {21140, 31710, 12684},
      {19026, 31710, 14798},
      {16912, 31710, 16912},
      {14798, 31710, 19026},
      {12684, 31710, 21140},
      {10570, 31710, 23254},
      {8456, 31710, 25368},
      {6342, 31710, 27482},
      {4228, 31710, 29596},
      {2114, 31710, 31710},
      {0, 31710, 33825}
    ],
    [
      {65535, 29596, 0},
      {63421, 29596, 0},
      {61307, 29596, 0},
      {59193, 29596, 0},
      {57079, 29596, 0},
      {54965, 29596, 0},
      {52851, 29596, 0},
      {50737, 29596, 0},
      {48623, 29596, 0},
      {46509, 29596, 0},
      {44395, 29596, 0},
      {42281, 29596, 0},
      {40167, 29596, 0},
      {38053, 29596, 0},
      {35939, 29596, 0},
      {33825, 29596, 2114},
      {31710, 29596, 4228},
      {29596, 29596, 6342},
      {27482, 29596, 8456},
      {25368, 29596, 10570},
      {23254, 29596, 12684},
      {21140, 29596, 14798},
      {19026, 29596, 16912},
      {16912, 29596, 19026},
      {14798, 29596, 21140},
      {12684, 29596, 23254},
      {10570, 29596, 25368},
      {8456, 29596, 27482},
      {6342, 29596, 29596},
      {4228, 29596, 31710},
      {2114, 29596, 33825},
      {0, 29596, 35939}
    ],
    [
      {65535, 27482, 0},
      {63421, 27482, 0},
      {61307, 27482, 0},
      {59193, 27482, 0},
      {57079, 27482, 0},
      {54965, 27482, 0},
      {52851, 27482, 0},
      {50737, 27482, 0},
      {48623, 27482, 0},
      {46509, 27482, 0},
      {44395, 27482, 0},
      {42281, 27482, 0},
      {40167, 27482, 0},
      {38053, 27482, 0},
      {35939, 27482, 2114},
      {33825, 27482, 4228},
      {31710, 27482, 6342},
      {29596, 27482, 8456},
      {27482, 27482, 10570},
      {25368, 27482, 12684},
      {23254, 27482, 14798},
      {21140, 27482, 16912},
      {19026, 27482, 19026},
      {16912, 27482, 21140},
      {14798, 27482, 23254},
      {12684, 27482, 25368},
      {10570, 27482, 27482},
      {8456, 27482, 29596},
      {6342, 27482, 31710},
      {4228, 27482, 33825},
      {2114, 27482, 35939},
      {0, 27482, 38053}
    ],
    [
      {65535, 25368, 0},
      {63421, 25368, 0},
      {61307, 25368, 0},
      {59193, 25368, 0},
      {57079, 25368, 0},
      {54965, 25368, 0},
      {52851, 25368, 0},
      {50737, 25368, 0},
      {48623, 25368, 0},
      {46509, 25368, 0},
      {44395, 25368, 0},
      {42281, 25368, 0},
      {40167, 25368, 0},
      {38053, 25368, 2114},
      {35939, 25368, 4228},
      {33825, 25368, 6342},
      {31710, 25368, 8456},
      {29596, 25368, 10570},
      {27482, 25368, 12684},
      {25368, 25368, 14798},
      {23254, 25368, 16912},
      {21140, 25368, 19026},
      {19026, 25368, 21140},
      {16912, 25368, 23254},
      {14798, 25368, 25368},
      {12684, 25368, 27482},
      {10570, 25368, 29596},
      {8456, 25368, 31710},
      {6342, 25368, 33825},
      {4228, 25368, 35939},
      {2114, 25368, 38053},
      {0, 25368, 40167}
    ],
    [
      {65535, 23254, 0},
      {63421, 23254, 0},
      {61307, 23254, 0},
      {59193, 23254, 0},
      {57079, 23254, 0},
      {54965, 23254, 0},
      {52851, 23254, 0},
      {50737, 23254, 0},
      {48623, 23254, 0},
      {46509, 23254, 0},
      {44395, 23254, 0},
      {42281, 23254, 0},
      {40167, 23254, 2114},
      {38053, 23254, 4228},
      {35939, 23254, 6342},
      {33825, 23254, 8456},
      {31710, 23254, 10570},
      {29596, 23254, 12684},
      {27482, 23254, 14798},
      {25368, 23254, 16912},
      {23254, 23254, 19026},
      {21140, 23254, 21140},
      {19026, 23254, 23254},
      {16912, 23254, 25368},
      {14798, 23254, 27482},
      {12684, 23254, 29596},
      {10570, 23254, 31710},
      {8456, 23254, 33825},
      {6342, 23254, 35939},
      {4228, 23254, 38053},
      {2114, 23254, 40167},
      {0, 23254, 42281}
    ],
    [
      {65535, 21140, 0},
      {63421, 21140, 0},
      {61307, 21140, 0},
      {59193, 21140, 0},
      {57079, 21140, 0},
      {54965, 21140, 0},
      {52851, 21140, 0},
      {50737, 21140, 0},
      {48623, 21140, 0},
      {46509, 21140, 0},
      {44395, 21140, 0},
      {42281, 21140, 2114},
      {40167, 21140, 4228},
      {38053, 21140, 6342},
      {35939, 21140, 8456},
      {33825, 21140, 10570},
      {31710, 21140, 12684},
      {29596, 21140, 14798},
      {27482, 21140, 16912},
      {25368, 21140, 19026},
      {23254, 21140, 21140},
      {21140, 21140, 23254},
      {19026, 21140, 25368},
      {16912, 21140, 27482},
      {14798, 21140, 29596},
      {12684, 21140, 31710},
      {10570, 21140, 33825},
      {8456, 21140, 35939},
      {6342, 21140, 38053},
      {4228, 21140, 40167},
      {2114, 21140, 42281},
      {0, 21140, 44395}
    ],
    [
      {65535, 19026, 0},
      {63421, 19026, 0},
      {61307, 19026, 0},
      {59193, 19026, 0},
      {57079, 19026, 0},
      {54965, 19026, 0},
      {52851, 19026, 0},
      {50737, 19026, 0},
      {48623, 19026, 0},
      {46509, 19026, 0},
      {44395, 19026, 2114},
      {42281, 19026, 4228},
      {40167, 19026, 6342},
      {38053, 19026, 8456},
      {35939, 19026, 10570},
      {33825, 19026, 12684},
      {31710, 19026, 14798},
      {29596, 19026, 16912},
      {27482, 19026, 19026},
      {25368, 19026, 21140},
      {23254, 19026, 23254},
      {21140, 19026, 25368},
      {19026, 19026, 27482},
      {16912, 19026, 29596},
      {14798, 19026, 31710},
      {12684, 19026, 33825},
      {10570, 19026, 35939},
      {8456, 19026, 38053},
      {6342, 19026, 40167},
      {4228, 19026, 42281},
      {2114, 19026, 44395},
      {0, 19026, 46509}
    ],
    [
      {65535, 16912, 0},
      {63421, 16912, 0},
      {61307, 16912, 0},
      {59193, 16912, 0},
      {57079, 16912, 0},
      {54965, 16912, 0},
      {52851, 16912, 0},
      {50737, 16912, 0},
      {48623, 16912, 0},
      {46509, 16912, 2114},
      {44395, 16912, 4228},
      {42281, 16912, 6342},
      {40167, 16912, 8456},
      {38053, 16912, 10570},
      {35939, 16912, 12684},
      {33825, 16912, 14798},
      {31710, 16912, 16912},
      {29596, 16912, 19026},
      {27482, 16912, 21140},
      {25368, 16912, 23254},
      {23254, 16912, 25368},
      {21140, 16912, 27482},
      {19026, 16912, 29596},
      {16912, 16912, 31710},
      {14798, 16912, 33825},
      {12684, 16912, 35939},
      {10570, 16912, 38053},
      {8456, 16912, 40167},
      {6342, 16912, 42281},
      {4228, 16912, 44395},
      {2114, 16912, 46509},
      {0, 16912, 48623}
    ],
    [
      {65535, 14798, 0},
      {63421, 14798, 0},
      {61307, 14798, 0},
      {59193, 14798, 0},
      {57079, 14798, 0},
      {54965, 14798, 0},
      {52851, 14798, 0},
      {50737, 14798, 0},
      {48623, 14798, 2114},
      {46509, 14798, 4228},
      {44395, 14798, 6342},
      {42281, 14798, 8456},
      {40167, 14798, 10570},
      {38053, 14798, 12684},
      {35939, 14798, 14798},
      {33825, 14798, 16912},
      {31710, 14798, 19026},
      {29596, 14798, 21140},
      {27482, 14798, 23254},
      {25368, 14798, 25368},
      {23254, 14798, 27482},
      {21140, 14798, 29596},
      {19026, 14798, 31710},
      {16912, 14798, 33825},
      {14798, 14798, 35939},
      {12684, 14798, 38053},
      {10570, 14798, 40167},
      {8456, 14798, 42281},
      {6342, 14798, 44395},
      {4228, 14798, 46509},
      {2114, 14798, 48623},
      {0, 14798, 50737}
    ],
    [
      {65535, 12684, 0},
      {63421, 12684, 0},
      {61307, 12684, 0},
      {59193, 12684, 0},
      {57079, 12684, 0},
      {54965, 12684, 0},
      {52851, 12684, 0},
      {50737, 12684, 2114},
      {48623, 12684, 4228},
      {46509, 12684, 6342},
      {44395, 12684, 8456},
      {42281, 12684, 10570},
      {40167, 12684, 12684},
      {38053, 12684, 14798},
      {35939, 12684, 16912},
      {33825, 12684, 19026},
      {31710, 12684, 21140},
      {29596, 12684, 23254},
      {27482, 12684, 25368},
      {25368, 12684, 27482},
      {23254, 12684, 29596},
      {21140, 12684, 31710},
      {19026, 12684, 33825},
      {16912, 12684, 35939},
      {14798, 12684, 38053},
      {12684, 12684, 40167},
      {10570, 12684, 42281},
      {8456, 12684, 44395},
      {6342, 12684, 46509},
      {4228, 12684, 48623},
      {2114, 12684, 50737},
      {0, 12684, 52851}
    ],
    [
      {65535, 10570, 0},
      {63421, 10570, 0},
      {61307, 10570, 0},
      {59193, 10570, 0},
      {57079, 10570, 0},
      {54965, 10570, 0},
      {52851, 10570, 2114},
      {50737, 10570, 4228},
      {48623, 10570, 6342},
      {46509, 10570, 8456},
      {44395, 10570, 10570},
      {42281, 10570, 12684},
      {40167, 10570, 14798},
      {38053, 10570, 16912},
      {35939, 10570, 19026},
      {33825, 10570, 21140},
      {31710, 10570, 23254},
      {29596, 10570, 25368},
      {27482, 10570, 27482},
      {25368, 10570, 29596},
      {23254, 10570, 31710},
      {21140, 10570, 33825},
      {19026, 10570, 35939},
      {16912, 10570, 38053},
      {14798, 10570, 40167},
      {12684, 10570, 42281},
      {10570, 10570, 44395},
      {8456, 10570, 46509},
      {6342, 10570, 48623},
      {4228, 10570, 50737},
      {2114, 10570, 52851},
      {0, 10570, 54965}
    ],
    [
      {65535, 8456, 0},
      {63421, 8456, 0},
      {61307, 8456, 0},
      {59193, 8456, 0},
      {57079, 8456, 0},
      {54965, 8456, 2114},
      {52851, 8456, 4228},
      {50737, 8456, 6342},
      {48623, 8456, 8456},
      {46509, 8456, 10570},
      {44395, 8456, 12684},
      {42281, 8456, 14798},
      {40167, 8456, 16912},
      {38053, 8456, 19026},
      {35939, 8456, 21140},
      {33825, 8456, 23254},
      {31710, 8456, 25368},
      {29596, 8456, 27482},
      {27482, 8456, 29596},
      {25368, 8456, 31710},
      {23254, 8456, 33825},
      {21140, 8456, 35939},
      {19026, 8456, 38053},
      {16912, 8456, 40167},
      {14798, 8456, 42281},
      {12684, 8456, 44395},
      {10570, 8456, 46509},
      {8456, 8456, 48623},
      {6342, 8456, 50737},
      {4228, 8456, 52851},
      {2114, 8456, 54965},
      {0, 8456, 57079}
    ],
    [
      {65535, 6342, 0},
      {63421, 6342, 0},
      {61307, 6342, 0},
      {59193, 6342, 0},
      {57079, 6342, 2114},
      {54965, 6342, 4228},
      {52851, 6342, 6342},
      {50737, 6342, 8456},
      {48623, 6342, 10570},
      {46509, 6342, 12684},
      {44395, 6342, 14798},
      {42281, 6342, 16912},
      {40167, 6342, 19026},
      {38053, 6342, 21140},
      {35939, 6342, 23254},
      {33825, 6342, 25368},
      {31710, 6342, 27482},
      {29596, 6342, 29596},
      {27482, 6342, 31710},
      {25368, 6342, 33825},
      {23254, 6342, 35939},
      {21140, 6342, 38053},
      {19026, 6342, 40167},
      {16912, 6342, 42281},
      {14798, 6342, 44395},
      {12684, 6342, 46509},
      {10570, 6342, 48623},
      {8456, 6342, 50737},
      {6342, 6342, 52851},
      {4228, 6342, 54965},
      {2114, 6342, 57079},
      {0, 6342, 59193}
    ],
    [
      {65535, 4228, 0},
      {63421, 4228, 0},
      {61307, 4228, 0},
      {59193, 4228, 2114},
      {57079, 4228, 4228},
      {54965, 4228, 6342},
      {52851, 4228, 8456},
      {50737, 4228, 10570},
      {48623, 4228, 12684},
      {46509, 4228, 14798},
      {44395, 4228, 16912},
      {42281, 4228, 19026},
      {40167, 4228, 21140},
      {38053, 4228, 23254},
      {35939, 4228, 25368},
      {33825, 4228, 27482},
      {31710, 4228, 29596},
      {29596, 4228, 31710},
      {27482, 4228, 33825},
      {25368, 4228, 35939},
      {23254, 4228, 38053},
      {21140, 4228, 40167},
      {19026, 4228, 42281},
      {16912, 4228, 44395},
      {14798, 4228, 46509},
      {12684, 4228, 48623},
      {10570, 4228, 50737},
      {8456, 4228, 52851},
      {6342, 4228, 54965},
      {4228, 4228, 57079},
      {2114, 4228, 59193},
      {0, 4228, 61307}
    ],
    [
      {65535, 2114, 0},
      {63421, 2114, 0},
      {61307, 2114, 2114},
      {59193, 2114, 4228},
      {57079, 2114, 6342},
      {54965, 2114, 8456},
      {52851, 2114, 10570},
      {50737, 2114, 12684},
      {48623, 2114, 14798},
      {46509, 2114, 16912},
      {44395, 2114, 19026},
      {42281, 2114, 21140},
      {40167, 2114, 23254},
      {38053, 2114, 25368},
      {35939, 2114, 27482},
      {33825, 2114, 29596},
      {31710, 2114, 31710},
      {29596, 2114, 33825},
      {27482, 2114, 35939},
      {25368, 2114, 38053},
      {23254, 2114, 40167},
      {21140, 2114, 42281},
      {19026, 2114, 44395},
      {16912, 2114, 46509},
      {14798, 2114, 48623},
      {12684, 2114, 50737},
      {10570, 2114, 52851},
      {8456, 2114, 54965},
      {6342, 2114, 57079},
      {4228, 2114, 59193},
      {2114, 2114, 61307},
      {0, 2114, 63421}
    ],
    [
      {65535, 0, 0},
      {63421, 0, 2114},
      {61307, 0, 4228},
      {59193, 0, 6342},
      {57079, 0, 8456},
      {54965, 0, 10570},
      {52851, 0, 12684},
      {50737, 0, 14798},
      {48623, 0, 16912},
      {46509, 0, 19026},
      {44395, 0, 21140},
      {42281, 0, 23254},
      {40167, 0, 25368},
      {38053, 0, 27482},
      {35939, 0, 29596},
      {33825, 0, 31710},
      {31710, 0, 33825},
      {29596, 0, 35939},
      {27482, 0, 38053},
      {25368, 0, 40167},
      {23254, 0, 42281},
      {21140, 0, 44395},
      {19026, 0, 46509},
      {16912, 0, 48623},
      {14798, 0, 50737},
      {12684, 0, 52851},
      {10570, 0, 54965},
      {8456, 0, 57079},
      {6342, 0, 59193},
      {4228, 0, 61307},
      {2114, 0, 63421},
      {0, 0, 65535}
    ]
  ]
  @grayscale_pixels [
    [
      {0},
      {2304},
      {4608},
      {6912},
      {9216},
      {11520},
      {13824},
      {16128},
      {18432},
      {20736},
      {23040},
      {25344},
      {27648},
      {29952},
      {32256},
      {34560},
      {36864},
      {39168},
      {41472},
      {43776},
      {46080},
      {48384},
      {50688},
      {52992},
      {55296},
      {57600},
      {59904},
      {62208},
      {64512},
      {61695},
      {54783},
      {47871}
    ],
    [
      {512},
      {2816},
      {5120},
      {7424},
      {9728},
      {12032},
      {14336},
      {16640},
      {18944},
      {21248},
      {23552},
      {25856},
      {28160},
      {30464},
      {32768},
      {35072},
      {37376},
      {39680},
      {41984},
      {44288},
      {46592},
      {48896},
      {51200},
      {53504},
      {55808},
      {58112},
      {60416},
      {62720},
      {65024},
      {60159},
      {53247},
      {46335}
    ],
    [
      {1024},
      {3328},
      {5632},
      {7936},
      {10240},
      {12544},
      {14848},
      {17152},
      {19456},
      {21760},
      {24064},
      {26368},
      {28672},
      {30976},
      {33280},
      {35584},
      {37888},
      {40192},
      {42496},
      {44800},
      {47104},
      {49408},
      {51712},
      {54016},
      {56320},
      {58624},
      {60928},
      {63232},
      {65535},
      {58623},
      {51711},
      {44799}
    ],
    [
      {1536},
      {3840},
      {6144},
      {8448},
      {10752},
      {13056},
      {15360},
      {17664},
      {19968},
      {22272},
      {24576},
      {26880},
      {29184},
      {31488},
      {33792},
      {36096},
      {38400},
      {40704},
      {43008},
      {45312},
      {47616},
      {49920},
      {52224},
      {54528},
      {56832},
      {59136},
      {61440},
      {63744},
      {63999},
      {57087},
      {50175},
      {43263}
    ],
    [
      {2048},
      {4352},
      {6656},
      {8960},
      {11264},
      {13568},
      {15872},
      {18176},
      {20480},
      {22784},
      {25088},
      {27392},
      {29696},
      {32000},
      {34304},
      {36608},
      {38912},
      {41216},
      {43520},
      {45824},
      {48128},
      {50432},
      {52736},
      {55040},
      {57344},
      {59648},
      {61952},
      {64256},
      {62463},
      {55551},
      {48639},
      {41727}
    ],
    [
      {2560},
      {4864},
      {7168},
      {9472},
      {11776},
      {14080},
      {16384},
      {18688},
      {20992},
      {23296},
      {25600},
      {27904},
      {30208},
      {32512},
      {34816},
      {37120},
      {39424},
      {41728},
      {44032},
      {46336},
      {48640},
      {50944},
      {53248},
      {55552},
      {57856},
      {60160},
      {62464},
      {64768},
      {60927},
      {54015},
      {47103},
      {40191}
    ],
    [
      {3072},
      {5376},
      {7680},
      {9984},
      {12288},
      {14592},
      {16896},
      {19200},
      {21504},
      {23808},
      {26112},
      {28416},
      {30720},
      {33024},
      {35328},
      {37632},
      {39936},
      {42240},
      {44544},
      {46848},
      {49152},
      {51456},
      {53760},
      {56064},
      {58368},
      {60672},
      {62976},
      {65280},
      {59391},
      {52479},
      {45567},
      {38655}
    ],
    [
      {3584},
      {5888},
      {8192},
      {10496},
      {12800},
      {15104},
      {17408},
      {19712},
      {22016},
      {24320},
      {26624},
      {28928},
      {31232},
      {33536},
      {35840},
      {38144},
      {40448},
      {42752},
      {45056},
      {47360},
      {49664},
      {51968},
      {54272},
      {56576},
      {58880},
      {61184},
      {63488},
      {64767},
      {57855},
      {50943},
      {44031},
      {37119}
    ],
    [
      {4096},
      {6400},
      {8704},
      {11008},
      {13312},
      {15616},
      {17920},
      {20224},
      {22528},
      {24832},
      {27136},
      {29440},
      {31744},
      {34048},
      {36352},
      {38656},
      {40960},
      {43264},
      {45568},
      {47872},
      {50176},
      {52480},
      {54784},
      {57088},
      {59392},
      {61696},
      {64000},
      {63231},
      {56319},
      {49407},
      {42495},
      {35583}
    ],
    [
      {4608},
      {6912},
      {9216},
      {11520},
      {13824},
      {16128},
      {18432},
      {20736},
      {23040},
      {25344},
      {27648},
      {29952},
      {32256},
      {34560},
      {36864},
      {39168},
      {41472},
      {43776},
      {46080},
      {48384},
      {50688},
      {52992},
      {55296},
      {57600},
      {59904},
      {62208},
      {64512},
      {61695},
      {54783},
      {47871},
      {40959},
      {34047}
    ],
    [
      {5120},
      {7424},
      {9728},
      {12032},
      {14336},
      {16640},
      {18944},
      {21248},
      {23552},
      {25856},
      {28160},
      {30464},
      {32768},
      {35072},
      {37376},
      {39680},
      {41984},
      {44288},
      {46592},
      {48896},
      {51200},
      {53504},
      {55808},
      {58112},
      {60416},
      {62720},
      {65024},
      {60159},
      {53247},
      {46335},
      {39423},
      {32511}
    ],
    [
      {5632},
      {7936},
      {10240},
      {12544},
      {14848},
      {17152},
      {19456},
      {21760},
      {24064},
      {26368},
      {28672},
      {30976},
      {33280},
      {35584},
      {37888},
      {40192},
      {42496},
      {44800},
      {47104},
      {49408},
      {51712},
      {54016},
      {56320},
      {58624},
      {60928},
      {63232},
      {65535},
      {58623},
      {51711},
      {44799},
      {37887},
      {30975}
    ],
    [
      {6144},
      {8448},
      {10752},
      {13056},
      {15360},
      {17664},
      {19968},
      {22272},
      {24576},
      {26880},
      {29184},
      {31488},
      {33792},
      {36096},
      {38400},
      {40704},
      {43008},
      {45312},
      {47616},
      {49920},
      {52224},
      {54528},
      {56832},
      {59136},
      {61440},
      {63744},
      {63999},
      {57087},
      {50175},
      {43263},
      {36351},
      {29439}
    ],
    [
      {6656},
      {8960},
      {11264},
      {13568},
      {15872},
      {18176},
      {20480},
      {22784},
      {25088},
      {27392},
      {29696},
      {32000},
      {34304},
      {36608},
      {38912},
      {41216},
      {43520},
      {45824},
      {48128},
      {50432},
      {52736},
      {55040},
      {57344},
      {59648},
      {61952},
      {64256},
      {62463},
      {55551},
      {48639},
      {41727},
      {34815},
      {27903}
    ],
    [
      {7168},
      {9472},
      {11776},
      {14080},
      {16384},
      {18688},
      {20992},
      {23296},
      {25600},
      {27904},
      {30208},
      {32512},
      {34816},
      {37120},
      {39424},
      {41728},
      {44032},
      {46336},
      {48640},
      {50944},
      {53248},
      {55552},
      {57856},
      {60160},
      {62464},
      {64768},
      {60927},
      {54015},
      {47103},
      {40191},
      {33279},
      {26367}
    ],
    [
      {7680},
      {9984},
      {12288},
      {14592},
      {16896},
      {19200},
      {21504},
      {23808},
      {26112},
      {28416},
      {30720},
      {33024},
      {35328},
      {37632},
      {39936},
      {42240},
      {44544},
      {46848},
      {49152},
      {51456},
      {53760},
      {56064},
      {58368},
      {60672},
      {62976},
      {65280},
      {59391},
      {52479},
      {45567},
      {38655},
      {31743},
      {24831}
    ],
    [
      {8192},
      {10496},
      {12800},
      {15104},
      {17408},
      {19712},
      {22016},
      {24320},
      {26624},
      {28928},
      {31232},
      {33536},
      {35840},
      {38144},
      {40448},
      {42752},
      {45056},
      {47360},
      {49664},
      {51968},
      {54272},
      {56576},
      {58880},
      {61184},
      {63488},
      {64767},
      {57855},
      {50943},
      {44031},
      {37119},
      {30207},
      {23295}
    ],
    [
      {8704},
      {11008},
      {13312},
      {15616},
      {17920},
      {20224},
      {22528},
      {24832},
      {27136},
      {29440},
      {31744},
      {34048},
      {36352},
      {38656},
      {40960},
      {43264},
      {45568},
      {47872},
      {50176},
      {52480},
      {54784},
      {57088},
      {59392},
      {61696},
      {64000},
      {63231},
      {56319},
      {49407},
      {42495},
      {35583},
      {28671},
      {21759}
    ],
    [
      {9216},
      {11520},
      {13824},
      {16128},
      {18432},
      {20736},
      {23040},
      {25344},
      {27648},
      {29952},
      {32256},
      {34560},
      {36864},
      {39168},
      {41472},
      {43776},
      {46080},
      {48384},
      {50688},
      {52992},
      {55296},
      {57600},
      {59904},
      {62208},
      {64512},
      {61695},
      {54783},
      {47871},
      {40959},
      {34047},
      {27135},
      {20223}
    ],
    [
      {9728},
      {12032},
      {14336},
      {16640},
      {18944},
      {21248},
      {23552},
      {25856},
      {28160},
      {30464},
      {32768},
      {35072},
      {37376},
      {39680},
      {41984},
      {44288},
      {46592},
      {48896},
      {51200},
      {53504},
      {55808},
      {58112},
      {60416},
      {62720},
      {65024},
      {60159},
      {53247},
      {46335},
      {39423},
      {32511},
      {25599},
      {18687}
    ],
    [
      {10240},
      {12544},
      {14848},
      {17152},
      {19456},
      {21760},
      {24064},
      {26368},
      {28672},
      {30976},
      {33280},
      {35584},
      {37888},
      {40192},
      {42496},
      {44800},
      {47104},
      {49408},
      {51712},
      {54016},
      {56320},
      {58624},
      {60928},
      {63232},
      {65535},
      {58623},
      {51711},
      {44799},
      {37887},
      {30975},
      {24063},
      {17151}
    ],
    [
      {10752},
      {13056},
      {15360},
      {17664},
      {19968},
      {22272},
      {24576},
      {26880},
      {29184},
      {31488},
      {33792},
      {36096},
      {38400},
      {40704},
      {43008},
      {45312},
      {47616},
      {49920},
      {52224},
      {54528},
      {56832},
      {59136},
      {61440},
      {63744},
      {63999},
      {57087},
      {50175},
      {43263},
      {36351},
      {29439},
      {22527},
      {15615}
    ],
    [
      {11264},
      {13568},
      {15872},
      {18176},
      {20480},
      {22784},
      {25088},
      {27392},
      {29696},
      {32000},
      {34304},
      {36608},
      {38912},
      {41216},
      {43520},
      {45824},
      {48128},
      {50432},
      {52736},
      {55040},
      {57344},
      {59648},
      {61952},
      {64256},
      {62463},
      {55551},
      {48639},
      {41727},
      {34815},
      {27903},
      {20991},
      {14079}
    ],
    [
      {11776},
      {14080},
      {16384},
      {18688},
      {20992},
      {23296},
      {25600},
      {27904},
      {30208},
      {32512},
      {34816},
      {37120},
      {39424},
      {41728},
      {44032},
      {46336},
      {48640},
      {50944},
      {53248},
      {55552},
      {57856},
      {60160},
      {62464},
      {64768},
      {60927},
      {54015},
      {47103},
      {40191},
      {33279},
      {26367},
      {19455},
      {12543}
    ],
    [
      {12288},
      {14592},
      {16896},
      {19200},
      {21504},
      {23808},
      {26112},
      {28416},
      {30720},
      {33024},
      {35328},
      {37632},
      {39936},
      {42240},
      {44544},
      {46848},
      {49152},
      {51456},
      {53760},
      {56064},
      {58368},
      {60672},
      {62976},
      {65280},
      {59391},
      {52479},
      {45567},
      {38655},
      {31743},
      {24831},
      {17919},
      {11007}
    ],
    [
      {12800},
      {15104},
      {17408},
      {19712},
      {22016},
      {24320},
      {26624},
      {28928},
      {31232},
      {33536},
      {35840},
      {38144},
      {40448},
      {42752},
      {45056},
      {47360},
      {49664},
      {51968},
      {54272},
      {56576},
      {58880},
      {61184},
      {63488},
      {64767},
      {57855},
      {50943},
      {44031},
      {37119},
      {30207},
      {23295},
      {16383},
      {9471}
    ],
    [
      {13312},
      {15616},
      {17920},
      {20224},
      {22528},
      {24832},
      {27136},
      {29440},
      {31744},
      {34048},
      {36352},
      {38656},
      {40960},
      {43264},
      {45568},
      {47872},
      {50176},
      {52480},
      {54784},
      {57088},
      {59392},
      {61696},
      {64000},
      {63231},
      {56319},
      {49407},
      {42495},
      {35583},
      {28671},
      {21759},
      {14847},
      {7935}
    ],
    [
      {13824},
      {16128},
      {18432},
      {20736},
      {23040},
      {25344},
      {27648},
      {29952},
      {32256},
      {34560},
      {36864},
      {39168},
      {41472},
      {43776},
      {46080},
      {48384},
      {50688},
      {52992},
      {55296},
      {57600},
      {59904},
      {62208},
      {64512},
      {61695},
      {54783},
      {47871},
      {40959},
      {34047},
      {27135},
      {20223},
      {13311},
      {6399}
    ],
    [
      {14336},
      {16640},
      {18944},
      {21248},
      {23552},
      {25856},
      {28160},
      {30464},
      {32768},
      {35072},
      {37376},
      {39680},
      {41984},
      {44288},
      {46592},
      {48896},
      {51200},
      {53504},
      {55808},
      {58112},
      {60416},
      {62720},
      {65024},
      {60159},
      {53247},
      {46335},
      {39423},
      {32511},
      {25599},
      {18687},
      {11775},
      {4863}
    ],
    [
      {14848},
      {17152},
      {19456},
      {21760},
      {24064},
      {26368},
      {28672},
      {30976},
      {33280},
      {35584},
      {37888},
      {40192},
      {42496},
      {44800},
      {47104},
      {49408},
      {51712},
      {54016},
      {56320},
      {58624},
      {60928},
      {63232},
      {65535},
      {58623},
      {51711},
      {44799},
      {37887},
      {30975},
      {24063},
      {17151},
      {10239},
      {3327}
    ],
    [
      {15360},
      {17664},
      {19968},
      {22272},
      {24576},
      {26880},
      {29184},
      {31488},
      {33792},
      {36096},
      {38400},
      {40704},
      {43008},
      {45312},
      {47616},
      {49920},
      {52224},
      {54528},
      {56832},
      {59136},
      {61440},
      {63744},
      {63999},
      {57087},
      {50175},
      {43263},
      {36351},
      {29439},
      {22527},
      {15615},
      {8703},
      {1791}
    ],
    [
      {15872},
      {18176},
      {20480},
      {22784},
      {25088},
      {27392},
      {29696},
      {32000},
      {34304},
      {36608},
      {38912},
      {41216},
      {43520},
      {45824},
      {48128},
      {50432},
      {52736},
      {55040},
      {57344},
      {59648},
      {61952},
      {64256},
      {62463},
      {55551},
      {48639},
      {41727},
      {34815},
      {27903},
      {20991},
      {14079},
      {7167},
      {255}
    ]
  ]
  test "grayscale with 1 IDAT chunk" do
    {:ok, image} = Imagineer.load(@test_path <> "oi1n0g16.png")

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

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

    assert_pixels_match(image.pixels, @grayscale_pixels)
  end

  test "RGB with 1 IDAT chunk" do
    {:ok, image} = Imagineer.load(@test_path <> "oi1n2c16.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 == 16
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @rgb_pixels)
  end

  test "grayscale with 2 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi2n0g16.png")

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

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

    assert_pixels_match(image.pixels, @grayscale_pixels)
  end

  test "RGB with 2 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi2n2c16.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 == 16
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @rgb_pixels)
  end

  test "grayscale with 4 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi4n0g16.png")

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

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

    assert_pixels_match(image.pixels, @grayscale_pixels)
  end

  test "RGB with 4 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi4n2c16.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 == 16
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @rgb_pixels)
  end

  test "grayscale with length 1 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi9n0g16.png")

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

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

    assert_pixels_match(image.pixels, @grayscale_pixels)
  end

  test "RGB with length 1 IDAT chunks" do
    {:ok, image} = Imagineer.load(@test_path <> "oi9n2c16.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 == 16
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @rgb_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
