[
{"fn": "base32Encode", "name": "RFC 4648 section 10: '' padded", "args": [[], true], "expect": ""},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'f' padded", "args": [[102], true], "expect": "MY======"},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'fo' padded", "args": [[102, 111], true], "expect": "MZXQ===="},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'foo' padded", "args": [[102, 111, 111], true], "expect": "MZXW6==="},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'foob' padded", "args": [[102, 111, 111, 98], true], "expect": "MZXW6YQ="},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'fooba' padded", "args": [[102, 111, 111, 98, 97], true], "expect": "MZXW6YTB"},
{"fn": "base32Encode", "name": "RFC 4648 section 10: 'foobar' padded", "args": [[102, 111, 111, 98, 97, 114], true], "expect": "MZXW6YTBOI======"},
{"fn": "base32Encode", "name": "RFC 4648 'f' without padding, as otpauth:// writes secrets", "args": [[102], false], "expect": "MY"},
{"fn": "base32Encode", "name": "RFC 4648 'foobar' without padding, as otpauth:// writes secrets", "args": [[102, 111, 111, 98, 97, 114], false], "expect": "MZXW6YTBOI"},
{"fn": "base32Encode", "name": "the RFC 4226 HOTP test secret, 20 bytes, needs no padding", "args": [[49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48], false], "expect": "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"},
{"fn": "base32Encode", "name": "every bit set (hand-checked: five 0xff bytes are eight 7s)", "args": [[255, 255, 255, 255, 255], true], "expect": "77777777"},
{"fn": "base32Encode", "name": "a byte above 255", "args": [[256], true], "expectError": "bytes must be a list of integers from 0 to 255"},
{"fn": "base32Encode", "name": "a fractional byte", "args": [[1.5], false], "expectError": "bytes must be a list of integers from 0 to 255"},
{"fn": "base32Encode", "name": "padding given as text", "args": [[1], "yes"], "expectError": "padding must be true or false"},
{"fn": "base32Decode", "name": "RFC 4648 section 10: '' padded", "args": [""], "expect": []},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'f' padded", "args": ["MY======"], "expect": [102]},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'fo' padded", "args": ["MZXQ===="], "expect": [102, 111]},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'foo' padded", "args": ["MZXW6==="], "expect": [102, 111, 111]},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'foob' padded", "args": ["MZXW6YQ="], "expect": [102, 111, 111, 98]},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'fooba' padded", "args": ["MZXW6YTB"], "expect": [102, 111, 111, 98, 97]},
{"fn": "base32Decode", "name": "RFC 4648 section 10: 'foobar' padded", "args": ["MZXW6YTBOI======"], "expect": [102, 111, 111, 98, 97, 114]},
{"fn": "base32Decode", "name": "\"foobar\" without padding", "args": ["MZXW6YTBOI"], "expect": [102, 111, 111, 98, 97, 114]},
{"fn": "base32Decode", "name": "lower case is read as upper case", "args": ["mzxw6ytboi======"], "expect": [102, 111, 111, 98, 97, 114]},
{"fn": "base32Decode", "name": "the RFC 4226 HOTP test secret", "args": ["GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"], "expect": [49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48]},
{"fn": "base32Decode", "name": "a space between groups is not skipped", "args": ["MZXW 6YTB"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "a hyphen is not skipped", "args": ["MZXW-6YTB"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "0, 1, 8 and 9 are not in the alphabet", "args": ["MZXW0YTB"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "a trailing newline", "args": ["MZXW6YTBOI\n"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "an Arabic-Indic digit is not 2-7", "args": ["MZXW\u0662YTB"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "a character after the padding", "args": ["MY======A"], "expectError": "base32 text may only contain A-Z and 2-7, with = padding at the end"},
{"fn": "base32Decode", "name": "one character past a block: no byte count is 5 bits", "args": ["MZXW6YTBO"], "expectError": "base32 text has a length that no byte count produces"},
{"fn": "base32Decode", "name": "three characters: no byte count is 15 bits", "args": ["MZX"], "expectError": "base32 text has a length that no byte count produces"},
{"fn": "base32Decode", "name": "padding of the wrong length", "args": ["MY====="], "expectError": "base32 text has the wrong amount of = padding"},
{"fn": "base32Decode", "name": "padding on whole blocks", "args": ["MZXW6YTB========"], "expectError": "base32 text has the wrong amount of = padding"},
{"fn": "base32Decode", "name": "non-zero bits after the last byte (\"M3\" would also read as \"f\")", "args": ["M3======"], "expectError": "base32 text has non-zero bits after its last byte"},
{"fn": "base32Decode", "name": "a number instead of text", "args": [42], "expectError": "base32 text must be a string"}
]