package main

// Reference QR matrices, produced by the Python "qrcode" package - an
// implementation SnapBeam shares no code with - and pasted here verbatim, so
// that TestQRMatrixMatchesIndependentReference can compare SnapBeam's encoder
// module for module against a second opinion rather than against itself.
// '#' is a dark module.
//
// Each reference is generated with an EXPLICIT mask pattern. That is
// deliberate: python-qrcode chooses its mask by scoring a symbol whose format
// modules have been blanked out, while ISO/IEC 18004 section 8.8.2 scores the
// complete symbol, so the two implementations legitimately pick different
// masks for the same data. Fixing the mask compares everything else - the bit
// stream, the block split, the Reed-Solomon codewords, the interleaving, the
// zigzag placement, the format bits and the version bits - exactly. Mask
// selection is checked separately by TestQRMaskSelectionMinimisesThePenalty.
//
// Regenerate with the snippet below, which pins the mode as well as the mask:
//
//	python3 -c "import qrcode; from qrcode.util import QRData, MODE_8BIT_BYTE; \
//	  q=qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_M, \
//	                  box_size=1,border=0,mask_pattern=6); \
//	  q.add_data(QRData(b'...', mode=MODE_8BIT_BYTE, check_data=False)); q.make(fit=True); \
//	  print('\n'.join(''.join('#' if c else '.' for c in r) for r in q.get_matrix()))"
//
// The explicit MODE_8BIT_BYTE matters: left to itself python-qrcode splits a
// URL into byte and alphanumeric segments, which is a perfectly valid but
// different encoding of the same string. SnapBeam only ever emits byte mode.

// version 1 at level L, one block, no alignment pattern.
// Payload 8 bytes in byte mode, mask 3, 21 modules square.
var qrRefV1L = []string{
	"#######.##..#.#######",
	"#.....#..#..#.#.....#",
	"#.###.#.#.#.#.#.###.#",
	"#.###.#.#..#..#.###.#",
	"#.###.#.###...#.###.#",
	"#.....#.......#.....#",
	"#######.#.#.#.#######",
	".........##..........",
	"####..#.#.#..#..###.#",
	"##...#..#...######..#",
	"#######.##..####.####",
	"#....#.##...##.###..#",
	"..###.#.####...#.....",
	"........###..#..##.##",
	"#######...#..#####...",
	"#.....#...#####..##..",
	"#.###.#....#..##..#..",
	"#.###.#.#.#..#.....#.",
	"#.###.#.##.#.#....#..",
	"#.....#.#..##.#.#...#",
	"#######.#..##...#....",
}

// version 3 at level M, a real SnapBeam pairing URL.
// Payload 33 bytes in byte mode, mask 6, 29 modules square.
var qrRefV3M = []string{
	"#######.########.#..#.#######",
	"#.....#.##...###.###..#.....#",
	"#.###.#.#.#.###.......#.###.#",
	"#.###.#..#.#..##.##...#.###.#",
	"#.###.#.#..#.#.#.#.##.#.###.#",
	"#.....#....#.##..##.#.#.....#",
	"#######.#.#.#.#.#.#.#.#######",
	".........#.##.#....#.........",
	"#..######..#.#########..#.###",
	".##.##.######.#....###..#.##.",
	".#..#.##..##..#.....#...#.#..",
	"###..#..#..##.##.#.#...##...#",
	".##.#.#...#..##.#.#..##.....#",
	"#..##..####......##.###.##.##",
	"..###.#.####..##.#.#.#...##.#",
	".#####.##########...#.##..#.#",
	"#..##.#...##...##.#..#.#.....",
	"#.##.#...#.....#####...#####.",
	"##...#####...###..###..#....#",
	"##.##...#...##......#.#.###..",
	"##.#..#....#.#.#.###########.",
	"........#.##.#.##..##...##...",
	"#######.#....#.###.##.#.##...",
	"#.....#.#..#.#..###.#...#..##",
	"#.###.#.#.#..#....#######..##",
	"#.###.#.##.##.##.#.#...#.##.#",
	"#.###.#..###.#.##.#.#...#..##",
	"#.....#..#.######.#...###.#.#",
	"#######.#.#..####.#.#..#.#...",
}

// version 5 at level H, two block groups of unequal size.
// Payload 40 bytes in byte mode, mask 5, 37 modules square.
var qrRefV5H = []string{
	"#######.#..##..#.###..###.....#######",
	"#.....#...#..#....##.#.#....#.#.....#",
	"#.###.#.#.##.#.......#..#.##..#.###.#",
	"#.###.#..#.#..#...##.....#.#..#.###.#",
	"#.###.#.##..##..#.##.######.#.#.###.#",
	"#.....#..#.###.#.#.#.######.#.#.....#",
	"#######.#.#.#.#.#.#.#.#.#.#.#.#######",
	"........#.....##..#....###...........",
	".....##..#.##..###.####.#.#...#.#.#.#",
	"...###..####..####....##.##.##.##..#.",
	"#.###.###.#..##.##.##.#....##..#...##",
	"#..##...#.####....#.###...#..##.##.##",
	"#.#...#.#####.##..#######.....#....#.",
	"#.#..#.#.#.###....##..#..#####.#..##.",
	"#.#...#.##.####.###.##.#...##..#...##",
	"#.......#.##...###....#.....###..####",
	"#.#...###..###.#####.##.###.#####.#..",
	".####..####...##..##.#.#.#####.#..##.",
	"#.#..###..##...#.#..#....###.#..#.#.#",
	"#.###..#..###.##..###.###.#..##.##..#",
	"##.#..####.#...######.##.##.#####.#..",
	"##.###.#..#.###.#...##.#...#.#.##..#.",
	"#..##.###.###..#.##.#...#..##..#...##",
	"#..###..#..#.......##..##.#..##.##.##",
	"#....##..###....#.##.#.#.##...#....#.",
	"#..###...#...##..#.#....######.#..##.",
	"#....###.#..##..##.###.....##..#...##",
	"#..#.#....####.######...#...###..####",
	"#..##.#.#.##..#..#.##.#..##.#####.#..",
	"........#####.#.#.#.##.#.####...#.##.",
	"#######..####.#.##....##.##.#.#.#.#.#",
	"#.....#.#..##.##...##.#.#.###...##.##",
	"#.###.#...#...##.....############.#..",
	"#.###.#..##..#...##.#....#.#####.....",
	"#.###.#...###.#...#...###..###.#....#",
	"#.....#..#..#.###.#.#..#..###..#.#..#",
	"#######..###......#..##.....#.##....#",
}

// version 7 at level M, the first version carrying version information.
// Payload 110 bytes in byte mode, mask 2, 45 modules square.
var qrRefV7M = []string{
	"#######.....#...##.#.###.#.#.##..#..#.#######",
	"#.....#..#....###....#.#######..##.#..#.....#",
	"#.###.#.###.#..#..#.#...#...#..###.#..#.###.#",
	"#.###.#.##..####.####.#..#....##...##.#.###.#",
	"#.###.#.#..##..###.######..#.##...###.#.###.#",
	"#.....#.##.#.....#..#...##.###..#.....#.....#",
	"#######.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#######",
	"........###.........#...#.#.#..####..........",
	"#.#####...####.#.#..#####.....##.#.#..#####..",
	".............####.#.######.#.##....###.#...##",
	".#....##...##......#.#..######..#.#.#####.##.",
	"###.#.............#....##.##...####...#.###..",
	"###..##....###...###..#.#...#.##.#.#.....#..#",
	"...#.....#.#.###.#....##.#.####....###.#...##",
	"###.####.#..#.#....########.##..#.#.#####.##.",
	"..####..#.##...#..##..#.#.#.#..####...#.###..",
	"###.###..#.##.#.###..#........##.#.#.....#..#",
	".#.##.....##.#####..####.#.#.##....###.#...##",
	"###.#.##.#..#...#..###.#######..#.#.#####.##.",
	"...#.#.#..##..###.##....###.#..####...#.###..",
	"#.########...#.####.#####.#...##.#.#######..#",
	"..###...#.###.####..#...####.##....##...#..##",
	".#.##.#.##...#....#.#.#.#..###..#.###.#.#.##.",
	".#.##...###..##.#####...#.#.#..####.#...###..",
	"#########.#.#..##.#######.....##.#..######..#",
	"..##...#.#..##.######.#..#.#.##.....#......##",
	".#.##.#.######.......###.#####..#.##.#.#..##.",
	".#.##...##...##.#....#.##.##...#####.######.#",
	"##.#.##.##......#..#....#..#..##.#..#.#.##.##",
	"...#....######..#...#.#..#.#.##.....#......##",
	"..#.#.##..#..###.###.##.######..#.##.#.#..##.",
	".####...##..###.#.####.#..#.#..#####.######..",
	"..#.###.###....#..###.........##.#..#.#.##..#",
	".#.###..#######.##.##.##.#.#.##.....#......##",
	"....#.##..#....####..#.#.#####..#.##.#.#..##.",
	".####...##..#.###.#....##...#..#####.######..",
	"#..##.#####.......########....##.#..######..#",
	"........####.###.#.##...#..#.##.....#...#..##",
	"#######..#..#.##..###.#.##.###..#.#.#.#.#.##.",
	"#.....#.#...#...#.###...#.#.#..####.#...###..",
	"#.###.#.#.#.#.#...#.#####.....##.#.#######..#",
	"#.###.#.####...#.#...#..##.#.##....#..#.#...#",
	"#.###.#.#.##..##.#..#....#####..#.###.....##.",
	"#.....#.....#...#..#####..#.#..####.##.#.##..",
	"#######.###.#.#.##.#.#.##.....##.#...#####.#.",
}

// version 8 at level M, two block groups AND version information.
// Payload 130 bytes in byte mode, mask 0, 49 modules square.
var qrRefV8M = []string{
	"#######..#.#..##...#.##...###.###.#..#..#.#######",
	"#.....#.#..####.##..#.###..#...#.#.######.#.....#",
	"#.###.#..###.#####.#...##..#...#...#...##.#.###.#",
	"#.###.#..#.#...#.#...###.##..##..##....#..#.###.#",
	"#.###.#.###.###..#..#.#####..##..##..#....#.###.#",
	"#.....#..####.#.#.#...#...###.###.###.#...#.....#",
	"#######.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#######",
	".........#..#.#....#..#...#.###.###.#####........",
	"#.#.#.#..#..#.....##.########..##..##..#....#..#.",
	"#..#.#.#.###.###.....##....##..##..##......####.#",
	".##..##..#.######.......##...#...#...#...#.....##",
	"...###..#...#..#...##...###.###.###.#######.#..##",
	"#.....###..##..###..##.##..##..##..##..#...###...",
	".##..#.#.#.#.#.####.#.###..##..##..##......####.#",
	"#..#.##...#.#.#...#......#...#...#...#...#.....##",
	"#.#......##..#....#.#.#.####..##..#.#######.#..##",
	"#.#.#.#...##.#...#.#..###..#...#...##..#...###...",
	"..##.#.####..#.#.#...####..##.###.###......####.#",
	"...#.##.#.#..#..##.......#.#..##..#..#...#.....##",
	".....#..#...####.#.##...#.#.###.###.#######.#..##",
	"..#.###...#..#.....#.#.##..##..##..##..#...###...",
	".###.#..#...###.###..####.###..##..##......####.#",
	"...########.##.#.##..######..#...#...#..#####..##",
	"#.#.#...#..#.#...#.####...#.###.###.###.#...#..##",
	"#.###.#.###..#.##.##..#.#.###..##..##...#.#.##...",
	"....#...##.##.#..##...#...###..##..##...#...###.#",
	".##.#######.#.##.....######..#...#...#.######..##",
	"##.###..#.#....#.####.####..###.###.###.#.###..##",
	"#.###.#.#..#...#.######.#..##..##..##...#..#.#...",
	"....##.#.###.#.#####.#..#####..##..##....##..##.#",
	"#..#.##....#.......###...##..#...#...#.#.##....##",
	"##...#..#..###.#...#.##.#.#..#...#..###.#.###..##",
	"#..#.##..#.#..#..###..##....###.#####...#..#.#..#",
	"#..#.#..###.#..#.....##..##..#...#.##....##..##.#",
	"...####...####.#.#....#..##.###.###..#.#.##....##",
	"###.....##...##.#####.###.#.###.###.###.#.###..##",
	"..##..####.######.##.###...##..##..##...#..#.#...",
	"##..##.....#.#####...#...####..##..##....##..##.#",
	".#...##........#.##..#...##..#...#...#.#.##....##",
	".###....#####.#.#####.###.#.###.###.###.#.###..##",
	"###...##....###.##.#..#######..##..##...######...",
	"........####...##.#...#...###..##..##..##...###.#",
	"#######...#####..##...#.#.#..#...#...#.##.#.#..##",
	"#.....#...##.#.#.#.####...#.###.###.#####...#..##",
	"#.###.#.#..###.#....#########..##..##..#######...",
	"#.###.#..##.....#...#.#.##.##..##..##...###.####.",
	"#.###.#.##....#.#.#....####..#...#...#.##..##....",
	"#.....#....##..#.#..######.#..##..#.#####..##..#.",
	"#######.#.#.......##.##..###...#...##....#...#.##",
}
