More tests
This commit is contained in:
parent
b0dcdf74bd
commit
4238fedee7
2 changed files with 28 additions and 4 deletions
|
|
@ -157,7 +157,8 @@ static inline integer_t shuffle_impl256(const integer_t value, const integer_t s
|
|||
#define shuffle_epi8 shuffle_impl256
|
||||
#define sum_bytes(x) (sum_bytes_128(simde_mm256_extracti128_si256(x, 0)) + sum_bytes_128(simde_mm256_extracti128_si256(x, 1)))
|
||||
#endif
|
||||
#if 1
|
||||
|
||||
#if 0
|
||||
#define print_register_as_bytes(r) { \
|
||||
printf("%s:\n", #r); \
|
||||
alignas(64) uint8_t data[sizeof(r)]; \
|
||||
|
|
|
|||
|
|
@ -184,9 +184,27 @@ def test_utf8_simd_decode(self):
|
|||
def reset_state():
|
||||
test_utf8_decode_to_sentinel(b'', -1)
|
||||
|
||||
def t(x, which=2):
|
||||
expected = test_utf8_decode_to_sentinel(x, 1)
|
||||
actual = test_utf8_decode_to_sentinel(x, which)
|
||||
def asbytes(x):
|
||||
if isinstance(x, str):
|
||||
x = x.encode()
|
||||
return x
|
||||
|
||||
def t(*a, which=2):
|
||||
|
||||
def parse_parts(which):
|
||||
esc_found = False
|
||||
parts = []
|
||||
for x in a:
|
||||
found_sentinel, x = test_utf8_decode_to_sentinel(asbytes(x), which)
|
||||
if found_sentinel:
|
||||
esc_found = found_sentinel
|
||||
parts.append(x)
|
||||
return esc_found, ''.join(parts)
|
||||
|
||||
reset_state()
|
||||
actual = parse_parts(1)
|
||||
reset_state()
|
||||
expected = parse_parts(which)
|
||||
self.ae(expected, actual, msg=f'Failed for {x!r} with {which=}\n{expected!r} !=\n{actual!r}')
|
||||
|
||||
def double_test(x):
|
||||
|
|
@ -197,11 +215,16 @@ def double_test(x):
|
|||
|
||||
x = double_test
|
||||
x('2:α3')
|
||||
x('2:α\x1b3')
|
||||
x('2:α3:≤4:😸|')
|
||||
x('abcd1234efgh5678')
|
||||
x('abc\x1bd1234efgh5678')
|
||||
x('abcd1234efgh5678ijklABCDmnopEFGH')
|
||||
|
||||
for which in (2, 3):
|
||||
t('abcdef', 'ghij')
|
||||
t('2:α3', ':≤4:😸|')
|
||||
|
||||
def test_esc_codes(self):
|
||||
s = self.create_screen()
|
||||
pb = partial(self.parse_bytes_dump, s)
|
||||
|
|
|
|||
Loading…
Reference in a new issue