diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d2265b8d15dbf3ac3ab0e99f1c3e945a1a2bd0f..5a80c43c7a605349e6634aeb5f974c641c4aeb94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,8 @@ check_symbol_exists(fdatasync unistd.h HAVE_FDATASYNC) check_function_exists(memmem HAVE_MEMMEM) check_function_exists(memrchr HAVE_MEMRCHR) +check_function_exists(funopen HAVE_FUNOPEN) + # # Some versions of GNU libc define non-portable __libc_stack_end # which we use to determine the end (or beginning, actually) of diff --git a/core b/core new file mode 100644 index 0000000000000000000000000000000000000000..ff60b61e427c3733da3cfcb2eed556ec18868de4 Binary files /dev/null and b/core differ diff --git a/include/fiob.h b/include/fiob.h new file mode 100644 index 0000000000000000000000000000000000000000..7a47f35ccf29a7e2087fdb80fe556a794aa048ba --- /dev/null +++ b/include/fiob.h @@ -0,0 +1,63 @@ +#ifndef TARANTOOL_FIOB_H_INCLUDED +#define TARANTOOL_FIOB_H_INCLUDED +/* + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/** + * POSIX file I/O: take into account EINTR (read and write exactly + * the requested number of bytes), log errors nicely, provide batch + * writes. + */ + + + + +#define O_DIRECT_BSIZE ( 4096 * 50 ) + +#include <sys/types.h> +#include <stdio.h> + +#if defined(__cplusplus) +extern "C" { +#endif /* defined(__cplusplus) */ + + +/** open file. The same as fopen (3) but allows additional options: + +'x' - O_EXCL flag +'d' - O_DIRECT flag + +*/ + +FILE *fiob_open(const char *path, const char *mode); + + +#if defined(__cplusplus) +} /* extern "C" */ +#endif +#endif /* TARANTOOL_FIOB_H_INCLUDED */ diff --git a/include/tarantool/config.h.cmake b/include/tarantool/config.h.cmake index 5a22fbc412e64d5371e40df872297d9c231ab47d..2fd9a2cc1bd9f016a7b8b34c4ee2e1b2f122914e 100644 --- a/include/tarantool/config.h.cmake +++ b/include/tarantool/config.h.cmake @@ -61,6 +61,12 @@ #ifndef HAVE_FDATASYNC #define fdatasync fsync #endif + +/* + * Defined if this platform has BSD specific funopen() + */ +#cmakedefine HAVE_FUNOPEN 1 + /* * Defined if this platform has GNU specific memmem(). */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f96545ee8cce465beb663cf1f17288b43ea7331a..710100f6569dd0daa8a5c041f653c773b3910bf6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -119,6 +119,7 @@ set (common_sources lua/lua_socket.cc lua/session.cc lua/cjson.cc + fiob.c ${lua_sources} ) diff --git a/src/fiob.c b/src/fiob.c new file mode 100644 index 0000000000000000000000000000000000000000..a956e5b78a199846d6c7cdfb6d30d86aefc762a1 --- /dev/null +++ b/src/fiob.c @@ -0,0 +1,357 @@ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include <fiob.h> + +#include <sys/types.h> +#include <stdbool.h> +#include <sys/uio.h> + +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <malloc.h> +#include <stdlib.h> +#include <errno.h> +#include <say.h> +#include <assert.h> +#include <unistd.h> +#include <tarantool/config.h> + + +struct fiob { + int fd; + size_t bsize; + size_t bfill; + char *buf; + char *path; + #ifdef HAVE_FUNOPEN + struct { + int (*read)(void *cookie, char *buf, int len); + int (*write)(void *cookie, char *buf, int len); + fpos_t (*seek)(void *cookie, fpos_t pos, int whence); + int (*close)(void *cookie); + } io; + #else + cookie_io_functions_t io; + #endif +}; + +static ssize_t +fiob_readf(struct fiob *f, char *buf, size_t count) +{ + ssize_t to_read = (ssize_t) count; + while (to_read > 0) { + ssize_t nrd = read(f->fd, buf, to_read); + if (nrd < 0) { + if (errno == EINTR) { + errno = 0; + continue; + } + if (errno == EAGAIN || errno == EWOULDBLOCK) + return count != to_read ? count - to_read : -1; + say_syserror("read, [%s]", f->path); + return -1; /* XXX: file position is unspecified */ + } + if (nrd == 0) + break; + + buf += nrd; + to_read -= nrd; + } + return count - to_read; +} + +#ifdef HAVE_FUNOPEN +static int +fiob_read(void *cookie, char *buf, int len) +#else +static ssize_t +fiob_read(void *cookie, char *buf, size_t len) +#endif +{ + struct fiob *f = (struct fiob *)cookie; + return fiob_readf(f, buf, len); +} + + +static ssize_t +fiob_writef(struct fiob *f, const char *buf, size_t count) +{ + int fd = f->fd; + ssize_t to_write = (ssize_t) count; + while (to_write > 0) { + ssize_t nwr = write(fd, buf, to_write); + if (nwr < 0) { + if (errno == EINTR) { + errno = 0; + continue; + } + if (errno == EAGAIN || errno == EWOULDBLOCK) + return count != to_write ? count - to_write : -1; + say_syserror("write, [%s]", f->path); + return -1; /* XXX: file position is unspecified */ + } + if (nwr == 0) + break; + + buf += nwr; + to_write -= nwr; + } + return count - to_write; +} + + +static int +fiob_flushb(struct fiob *f) +{ + if (!f->buf || !f->bfill) + return 0; + + off_t cur = lseek(f->fd, 0L, SEEK_CUR); + if (cur == (off_t)-1) + return -1; + + off_t size = lseek(f->fd, 0L, SEEK_END); + if (size == (off_t)-1) + return -1; + + if (lseek(f->fd, cur, SEEK_SET) == (off_t)-1) + return -1; + + assert(cur + f->bfill >= size); + if (fiob_writef(f, f->buf, f->bsize) < 0) + return -1; + lseek(f->fd, cur + f->bfill, SEEK_SET); + int res = ftruncate(f->fd, cur + f->bfill); + f->bfill = 0; + return res; +} + + +#ifdef HAVE_FUNOPEN +int +fiob_write(void *cookie, const char *buf, int len) +#else +ssize_t +fiob_write(void *cookie, const char *buf, size_t len) +#endif +{ + struct fiob *f = (struct fiob *)cookie; + ssize_t wrdone; + + if (f->buf) { + /* append buffer */ + if (f->bsize - f->bfill >= len) { + memcpy(f->buf + f->bfill, buf, len); + f->bfill += len; + return len; + } + + /* data is longer than buffer */ + if (f->bfill < f->bsize) { + memcpy(f->buf + f->bfill, buf, + len - (f->bsize - f->bfill)); + wrdone = fiob_writef(f, f->buf, f->bsize); + + if (wrdone < 0) + return wrdone; + + if (wrdone < f->bsize) { + if (wrdone <= f->bfill) { + f->bfill -= wrdone; + memcpy(f->buf, + f->buf + wrdone, + f->bfill - wrdone); + return fiob_write(cookie, buf, len); + } + wrdone -= f->bfill; + } + wrdone -= f->bfill; + f->bfill = 0; + buf += wrdone; + len -= wrdone; + + if (len > 0) { + wrdone += fiob_write(cookie, buf, len); + } + return wrdone; + } + + wrdone = fiob_writef(f, f->buf, f->bsize); + if (wrdone < 0) + return wrdone; + if (wrdone < f->bsize) { + f->bfill = f->bsize - wrdone; + memcpy(f->buf, f->buf + wrdone, f->bfill); + } + return fiob_write(cookie, buf, len); + } + + return fiob_writef(f, buf, len); +} + +#ifdef HAVE_FUNOPEN +fpos_t +fiob_seek(void *cookie, fpos_t pos, int whence) +{ + struct fiob *f = (struct fiob *)cookie; + if (fiob_flushb(f) < 0) + return -1; + + return lseek(f->fd, pos, whence); +} +#else +int +fiob_seek(void *cookie, off64_t *pos, int whence) +{ + struct fiob *f = (struct fiob *)cookie; + if (fiob_flushb(f) < 0) + return -1; + + off_t newpos = lseek(f->fd, *pos, whence); + + if (newpos == (off_t)-1) + return -1; + + *pos = newpos; + return 0; +} +#endif + +static int +fiob_close(void *cookie) +{ + struct fiob *f = (struct fiob *)cookie; + int res = 0; + if (fiob_flushb(f) < 0) + res = -1; + + int save_errno = errno; + + if (close(f->fd) < 0) { + if (res < 0) + errno = save_errno; + res = -1; + } + + + free(f->buf); + free(f->path); + free(f); + + errno = save_errno; + return res; +} + + +FILE * +fiob_open(const char *path, const char *mode) +{ + int flags = 0; + int omode = 0666; + + size_t bsize = 0; + char *buf = NULL; + + int um = umask(0722); + umask(um); + omode &= ~um; + + + if (strchr(mode, 'r')) { + if (strchr(mode, '+')) + flags |= O_RDWR; + else + flags |= O_RDONLY; + } else if (strchr(mode, 'w')) { + flags |= O_TRUNC | O_CREAT; + if (strchr(mode, '+')) + flags |= O_RDWR; + else + flags |= O_WRONLY; + } else if (strchr(mode, 'a')) { + flags |= O_CREAT | O_APPEND; + if (strchr(mode, '+')) + flags |= O_RDWR; + else + flags |= O_WRONLY; + } else { + errno = EINVAL; + return NULL; + } + + /* O_EXCL */ + #ifdef O_EXCL + if (strchr(mode, 'x')) { + flags |= O_EXCL; + } + #endif + + /* O_DIRECT */ + if (strchr(mode, 'd')) { + #ifdef O_DIRECT + flags |= O_DIRECT; + #endif + bsize = O_DIRECT_BSIZE; + buf = (char *)memalign(4096, bsize); + if (!buf) { + errno = ENOMEM; + return NULL; + } + } + + struct fiob *f = (struct fiob *)calloc(1, sizeof(struct fiob)); + if (!f) { + free(buf); + errno = ENOMEM; + return NULL; + } + + f->path = strdup(path); + if (!f->path) { + errno = ENOMEM; + goto error; + } + + f->buf = buf; + f->bsize = bsize; + + f->fd = open(path, flags, omode); + if (f->fd < 0) + goto error; + + + f->io.read = fiob_read; + f->io.write = fiob_write; + f->io.seek = fiob_seek; + f->io.close = fiob_close; + + FILE *file; + #ifdef HAVE_FUNOPEN + file = funopen(f, + f->io.read, f->io.write, f->io.seek, f->io.close); + #else + file = fopencookie(f, mode, f->io); + #endif + + if (!file) + goto error; + + return file; + +error: { + int save_errno = errno; + say_syserror("Can't open '%s'", path); + if (f->fd > 0) + close(f->fd); + + free(f->buf); + free(f->path); + free(f); + + errno = save_errno; + } + return NULL; +} diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 87e0a68347d29abd3ba061d70cd131d6159a9ce4..cfadd2e741f0629edbbe0ab890830cb0e5d2d968 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,6 +1,7 @@ file(GLOB all_sources *.c *.m *.mm) set_source_files_compile_flags(${all_sources}) +add_executable(fiob.test test.c fiob.c ${CMAKE_SOURCE_DIR}/src/fiob.c) add_executable(rlist.test rlist.c test.c) add_executable(queue.test queue.c) add_executable(mhash.test mhash.c) diff --git a/test/unit/fiob.c b/test/unit/fiob.c new file mode 100644 index 0000000000000000000000000000000000000000..02201e9d5f7c4d785dcbf714d1efc2b04ab20dc6 --- /dev/null +++ b/test/unit/fiob.c @@ -0,0 +1,152 @@ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <string.h> +#include <errno.h> + +#include "test.h" +#include <fiob.h> +#include <say.h> +#include <stdarg.h> +#include <errno.h> +#include <stdlib.h> + + + +#define PLAN 30 + +#define ITEMS 7 + + +const char * +catfile(const char *a, const char *b) +{ + size_t la = strlen(a); + size_t lb = strlen(b); + + char *r = malloc(la + lb + 1 + 2); + strcpy(r, a); + + if (a[la - 1] == '/' && b[0] == '/') { + strcat(r, b + 1); + return r; + } + + if (a[la - 1]== '/') { + strcat(r, b); + return r; + } + r[la] = '/'; + r[la + 1] = 0; + strcat(r, b); + return r; +} + + +void sayf(int level, const char *filename, int line, const char *error, + const char *format, ...) +{ + const char *dbg = getenv("DEBUG"); + if (!dbg) + return; + if (strcmp(dbg, "1") != 0) + return; + + printf("# "); + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + printf("\n#\tat %s line %d\n", filename, line); + if (error) + printf("#\t%s\n", error); +} +sayfunc_t _say = sayf; + +int +main(void) +{ + plan(PLAN); + + const char *td = mkdtemp(strdup("/tmp/fiob.XXXXXX")); + isnt(td, NULL, "tempdir is created"); + + char *buf = malloc(4096); + isnt(buf, NULL, "malloc"); + + { + + FILE *f = fiob_open(catfile(td, "t0"), "w+d"); + isnt(f, NULL, "common open"); + size_t done = fwrite("Hello, world", 1, 12, f); + is(done, 12, "Hello world is written (%zu bytes)", done); + + is(ftell(f), 12, "current position"); + is(fseek(f, 0L, SEEK_SET), 0, "set new position"); + is(ftell(f), 0, "current position %zu", ftell(f)); + + + done = fread(buf, 1, 12, f); + is(done, 12, "Hello world is read (%zu bytes)", done); + is(memcmp(buf, "Hello, world", 12), 0, "data"); + + is(fseek(f, 0L, SEEK_SET), 0, "set new position"); + done = fread(buf + 1, 1, 12, f); + is(done, 12, "Hello world is read (%zu bytes)", done); + is(memcmp(buf + 1, "Hello, world", 12), 0, "data"); + + + is(fseek(f, 0L, SEEK_SET), 0, "set new position"); + fwrite("ololo ololo ololo", 1, 17, f); + is(fseek(f, 1L, SEEK_SET), 0, "set new position"); + + done = fread(buf + 1, 1, 12, f); + is(done, 12, "data is read"); + is(memcmp(buf + 1, "lolo ololo ololo", 12), 0, "data is read"); + + is(fclose(f), 0, "fclose"); + + f = fopen(catfile(td, "t0"), "r"); + isnt(f, NULL, "reopened file"); + is(fseek(f, 0L, SEEK_END), 0, "move pos at finish"); + is(ftell(f), 17, "file size"); + is(fclose(f), 0, "fclose"); + + f = fiob_open(catfile(td, "t0"), "w+x"); + is(f, NULL, "common open: O_EXCL"); + } + + { + FILE *f = fiob_open(catfile(td, "t1"), "w+"); + isnt(f, NULL, "common open"); + size_t done = fwrite("Hello, world", 1, 12, f); + is(done, 12, "Hello world is written (%zu bytes)", done); + + is(fseek(f, 1, SEEK_SET), 0, "move pos"); + done = fwrite("Hello, world", 1, 12, f); + is(done, 12, "Hello world is written (%zu bytes)", done); + + is(fseek(f, 2, SEEK_SET), 0, "move pos"); + done = fread(buf, 1, 12, f); + is(done, 11, "read 11 bytes"); + is(memcmp(buf, "ello, world", 11), 0, "content was read"); + + is(fclose(f), 0, "fclose"); + } + + + + free(buf); + if (fork() == 0) + execl("/bin/rm", "/bin/rm", "-fr", td); + return check_plan(); +} diff --git a/test/unit/fiob.result b/test/unit/fiob.result new file mode 100644 index 0000000000000000000000000000000000000000..7b4e154541774825d820274ec7cfd154f68405d7 --- /dev/null +++ b/test/unit/fiob.result @@ -0,0 +1,31 @@ +1..30 +ok 1 - tempdir is created +ok 2 - malloc +ok 3 - common open +ok 4 - Hello world is written (12 bytes) +ok 5 - current position +ok 6 - set new position +ok 7 - current position 0 +ok 8 - Hello world is read (12 bytes) +ok 9 - data +ok 10 - set new position +ok 11 - Hello world is read (12 bytes) +ok 12 - data +ok 13 - set new position +ok 14 - set new position +ok 15 - data is read +ok 16 - data is read +ok 17 - fclose +ok 18 - reopened file +ok 19 - move pos at finish +ok 20 - file size +ok 21 - fclose +ok 22 - common open: O_EXCL +ok 23 - common open +ok 24 - Hello world is written (12 bytes) +ok 25 - move pos +ok 26 - Hello world is written (12 bytes) +ok 27 - move pos +ok 28 - read 11 bytes +ok 29 - content was read +ok 30 - fclose diff --git a/test/unit/lf_lifo.result b/test/unit/lf_lifo.result new file mode 100644 index 0000000000000000000000000000000000000000..2e9ba477f89e86c5bbc86c0516283f59d8f6e178 --- /dev/null +++ b/test/unit/lf_lifo.result @@ -0,0 +1 @@ +success diff --git a/test/unit/msgpack.result b/test/unit/msgpack.result new file mode 100644 index 0000000000000000000000000000000000000000..16e0e38a1af5e3128210a4ee75517f2146ec1f61 --- /dev/null +++ b/test/unit/msgpack.result @@ -0,0 +1,1241 @@ +1..15 + 1..120 + # *** test_uints *** + # uint 0U + ok 1 - mp_decode(mp_encode(0U)) == 0U + ok 2 - mp_check_uint(0U) + ok 3 - len(mp_encode_uint(0U) + ok 4 - len(mp_decode_uint(0U)) + ok 5 - len(mp_next_uint(0U)) + ok 6 - len(mp_check_uint(0U)) + ok 7 - mp_sizeof_uint(0U) + ok 8 - mp_encode(0U) == "\x00" + # uint 1U + ok 9 - mp_decode(mp_encode(1U)) == 1U + ok 10 - mp_check_uint(1U) + ok 11 - len(mp_encode_uint(1U) + ok 12 - len(mp_decode_uint(1U)) + ok 13 - len(mp_next_uint(1U)) + ok 14 - len(mp_check_uint(1U)) + ok 15 - mp_sizeof_uint(1U) + ok 16 - mp_encode(1U) == "\x01" + # uint 0x7eU + ok 17 - mp_decode(mp_encode(0x7eU)) == 0x7eU + ok 18 - mp_check_uint(0x7eU) + ok 19 - len(mp_encode_uint(0x7eU) + ok 20 - len(mp_decode_uint(0x7eU)) + ok 21 - len(mp_next_uint(0x7eU)) + ok 22 - len(mp_check_uint(0x7eU)) + ok 23 - mp_sizeof_uint(0x7eU) + ok 24 - mp_encode(0x7eU) == "\x7e" + # uint 0x7fU + ok 25 - mp_decode(mp_encode(0x7fU)) == 0x7fU + ok 26 - mp_check_uint(0x7fU) + ok 27 - len(mp_encode_uint(0x7fU) + ok 28 - len(mp_decode_uint(0x7fU)) + ok 29 - len(mp_next_uint(0x7fU)) + ok 30 - len(mp_check_uint(0x7fU)) + ok 31 - mp_sizeof_uint(0x7fU) + ok 32 - mp_encode(0x7fU) == "\x7f" + # uint 0x80U + ok 33 - mp_decode(mp_encode(0x80U)) == 0x80U + ok 34 - mp_check_uint(0x80U) + ok 35 - len(mp_encode_uint(0x80U) + ok 36 - len(mp_decode_uint(0x80U)) + ok 37 - len(mp_next_uint(0x80U)) + ok 38 - len(mp_check_uint(0x80U)) + ok 39 - mp_sizeof_uint(0x80U) + ok 40 - mp_encode(0x80U) == "\xcc\x80" + # uint 0xfeU + ok 41 - mp_decode(mp_encode(0xfeU)) == 0xfeU + ok 42 - mp_check_uint(0xfeU) + ok 43 - len(mp_encode_uint(0xfeU) + ok 44 - len(mp_decode_uint(0xfeU)) + ok 45 - len(mp_next_uint(0xfeU)) + ok 46 - len(mp_check_uint(0xfeU)) + ok 47 - mp_sizeof_uint(0xfeU) + ok 48 - mp_encode(0xfeU) == "\xcc\xfe" + # uint 0xffU + ok 49 - mp_decode(mp_encode(0xffU)) == 0xffU + ok 50 - mp_check_uint(0xffU) + ok 51 - len(mp_encode_uint(0xffU) + ok 52 - len(mp_decode_uint(0xffU)) + ok 53 - len(mp_next_uint(0xffU)) + ok 54 - len(mp_check_uint(0xffU)) + ok 55 - mp_sizeof_uint(0xffU) + ok 56 - mp_encode(0xffU) == "\xcc\xff" + # uint 0xfffeU + ok 57 - mp_decode(mp_encode(0xfffeU)) == 0xfffeU + ok 58 - mp_check_uint(0xfffeU) + ok 59 - len(mp_encode_uint(0xfffeU) + ok 60 - len(mp_decode_uint(0xfffeU)) + ok 61 - len(mp_next_uint(0xfffeU)) + ok 62 - len(mp_check_uint(0xfffeU)) + ok 63 - mp_sizeof_uint(0xfffeU) + ok 64 - mp_encode(0xfffeU) == "\xcd\xff\xfe" + # uint 0xffffU + ok 65 - mp_decode(mp_encode(0xffffU)) == 0xffffU + ok 66 - mp_check_uint(0xffffU) + ok 67 - len(mp_encode_uint(0xffffU) + ok 68 - len(mp_decode_uint(0xffffU)) + ok 69 - len(mp_next_uint(0xffffU)) + ok 70 - len(mp_check_uint(0xffffU)) + ok 71 - mp_sizeof_uint(0xffffU) + ok 72 - mp_encode(0xffffU) == "\xcd\xff\xff" + # uint 0x10000U + ok 73 - mp_decode(mp_encode(0x10000U)) == 0x10000U + ok 74 - mp_check_uint(0x10000U) + ok 75 - len(mp_encode_uint(0x10000U) + ok 76 - len(mp_decode_uint(0x10000U)) + ok 77 - len(mp_next_uint(0x10000U)) + ok 78 - len(mp_check_uint(0x10000U)) + ok 79 - mp_sizeof_uint(0x10000U) + ok 80 - mp_encode(0x10000U) == "\xce\x00\x01\x00\x00" + # uint 0xfffffffeU + ok 81 - mp_decode(mp_encode(0xfffffffeU)) == 0xfffffffeU + ok 82 - mp_check_uint(0xfffffffeU) + ok 83 - len(mp_encode_uint(0xfffffffeU) + ok 84 - len(mp_decode_uint(0xfffffffeU)) + ok 85 - len(mp_next_uint(0xfffffffeU)) + ok 86 - len(mp_check_uint(0xfffffffeU)) + ok 87 - mp_sizeof_uint(0xfffffffeU) + ok 88 - mp_encode(0xfffffffeU) == "\xce\xff\xff\xff\xfe" + # uint 0xffffffffU + ok 89 - mp_decode(mp_encode(0xffffffffU)) == 0xffffffffU + ok 90 - mp_check_uint(0xffffffffU) + ok 91 - len(mp_encode_uint(0xffffffffU) + ok 92 - len(mp_decode_uint(0xffffffffU)) + ok 93 - len(mp_next_uint(0xffffffffU)) + ok 94 - len(mp_check_uint(0xffffffffU)) + ok 95 - mp_sizeof_uint(0xffffffffU) + ok 96 - mp_encode(0xffffffffU) == "\xce\xff\xff\xff\xff" + # uint 0x100000000UL + ok 97 - mp_decode(mp_encode(0x100000000UL)) == 0x100000000UL + ok 98 - mp_check_uint(0x100000000UL) + ok 99 - len(mp_encode_uint(0x100000000UL) + ok 100 - len(mp_decode_uint(0x100000000UL)) + ok 101 - len(mp_next_uint(0x100000000UL)) + ok 102 - len(mp_check_uint(0x100000000UL)) + ok 103 - mp_sizeof_uint(0x100000000UL) + ok 104 - mp_encode(0x100000000UL) == "\xcf\x00\x00\x00\x01\x00\x00\x00\x00" + # uint 0xfffffffffffffffeUL + ok 105 - mp_decode(mp_encode(0xfffffffffffffffeUL)) == 0xfffffffffffffffeUL + ok 106 - mp_check_uint(0xfffffffffffffffeUL) + ok 107 - len(mp_encode_uint(0xfffffffffffffffeUL) + ok 108 - len(mp_decode_uint(0xfffffffffffffffeUL)) + ok 109 - len(mp_next_uint(0xfffffffffffffffeUL)) + ok 110 - len(mp_check_uint(0xfffffffffffffffeUL)) + ok 111 - mp_sizeof_uint(0xfffffffffffffffeUL) + ok 112 - mp_encode(0xfffffffffffffffeUL) == "\xcf\xff\xff\xff\xff\xff\xff\xff\xfe" + # uint 0xffffffffffffffffUL + ok 113 - mp_decode(mp_encode(0xffffffffffffffffUL)) == 0xffffffffffffffffUL + ok 114 - mp_check_uint(0xffffffffffffffffUL) + ok 115 - len(mp_encode_uint(0xffffffffffffffffUL) + ok 116 - len(mp_decode_uint(0xffffffffffffffffUL)) + ok 117 - len(mp_next_uint(0xffffffffffffffffUL)) + ok 118 - len(mp_check_uint(0xffffffffffffffffUL)) + ok 119 - mp_sizeof_uint(0xffffffffffffffffUL) + ok 120 - mp_encode(0xffffffffffffffffUL) == "\xcf\xff\xff\xff\xff\xff\xff\xff\xff" + # *** test_uints: done *** +ok 1 - subtests + 1..136 + # *** test_ints *** + # int -0x01 + ok 1 - mp_decode(mp_encode(-0x01)) == -0x01 + ok 2 - mp_check_int(-0x01) + ok 3 - len(mp_encode_int(-0x01) + ok 4 - len(mp_decode_int(-0x01)) + ok 5 - len(mp_next_int(-0x01)) + ok 6 - len(mp_check_int(-0x01)) + ok 7 - mp_sizeof_int(-0x01) + ok 8 - mp_encode(-0x01) == "\xff" + # int -0x1e + ok 9 - mp_decode(mp_encode(-0x1e)) == -0x1e + ok 10 - mp_check_int(-0x1e) + ok 11 - len(mp_encode_int(-0x1e) + ok 12 - len(mp_decode_int(-0x1e)) + ok 13 - len(mp_next_int(-0x1e)) + ok 14 - len(mp_check_int(-0x1e)) + ok 15 - mp_sizeof_int(-0x1e) + ok 16 - mp_encode(-0x1e) == "\xe2" + # int -0x1f + ok 17 - mp_decode(mp_encode(-0x1f)) == -0x1f + ok 18 - mp_check_int(-0x1f) + ok 19 - len(mp_encode_int(-0x1f) + ok 20 - len(mp_decode_int(-0x1f)) + ok 21 - len(mp_next_int(-0x1f)) + ok 22 - len(mp_check_int(-0x1f)) + ok 23 - mp_sizeof_int(-0x1f) + ok 24 - mp_encode(-0x1f) == "\xe1" + # int -0x20 + ok 25 - mp_decode(mp_encode(-0x20)) == -0x20 + ok 26 - mp_check_int(-0x20) + ok 27 - len(mp_encode_int(-0x20) + ok 28 - len(mp_decode_int(-0x20)) + ok 29 - len(mp_next_int(-0x20)) + ok 30 - len(mp_check_int(-0x20)) + ok 31 - mp_sizeof_int(-0x20) + ok 32 - mp_encode(-0x20) == "\xe0" + # int -0x21 + ok 33 - mp_decode(mp_encode(-0x21)) == -0x21 + ok 34 - mp_check_int(-0x21) + ok 35 - len(mp_encode_int(-0x21) + ok 36 - len(mp_decode_int(-0x21)) + ok 37 - len(mp_next_int(-0x21)) + ok 38 - len(mp_check_int(-0x21)) + ok 39 - mp_sizeof_int(-0x21) + ok 40 - mp_encode(-0x21) == "\xd0\xdf" + # int -0x7f + ok 41 - mp_decode(mp_encode(-0x7f)) == -0x7f + ok 42 - mp_check_int(-0x7f) + ok 43 - len(mp_encode_int(-0x7f) + ok 44 - len(mp_decode_int(-0x7f)) + ok 45 - len(mp_next_int(-0x7f)) + ok 46 - len(mp_check_int(-0x7f)) + ok 47 - mp_sizeof_int(-0x7f) + ok 48 - mp_encode(-0x7f) == "\xd0\x81" + # int -0x80 + ok 49 - mp_decode(mp_encode(-0x80)) == -0x80 + ok 50 - mp_check_int(-0x80) + ok 51 - len(mp_encode_int(-0x80) + ok 52 - len(mp_decode_int(-0x80)) + ok 53 - len(mp_next_int(-0x80)) + ok 54 - len(mp_check_int(-0x80)) + ok 55 - mp_sizeof_int(-0x80) + ok 56 - mp_encode(-0x80) == "\xd0\x80" + # int -0x81 + ok 57 - mp_decode(mp_encode(-0x81)) == -0x81 + ok 58 - mp_check_int(-0x81) + ok 59 - len(mp_encode_int(-0x81) + ok 60 - len(mp_decode_int(-0x81)) + ok 61 - len(mp_next_int(-0x81)) + ok 62 - len(mp_check_int(-0x81)) + ok 63 - mp_sizeof_int(-0x81) + ok 64 - mp_encode(-0x81) == "\xd1\xff\x7f" + # int -0x7fff + ok 65 - mp_decode(mp_encode(-0x7fff)) == -0x7fff + ok 66 - mp_check_int(-0x7fff) + ok 67 - len(mp_encode_int(-0x7fff) + ok 68 - len(mp_decode_int(-0x7fff)) + ok 69 - len(mp_next_int(-0x7fff)) + ok 70 - len(mp_check_int(-0x7fff)) + ok 71 - mp_sizeof_int(-0x7fff) + ok 72 - mp_encode(-0x7fff) == "\xd1\x80\x01" + # int -0x8000 + ok 73 - mp_decode(mp_encode(-0x8000)) == -0x8000 + ok 74 - mp_check_int(-0x8000) + ok 75 - len(mp_encode_int(-0x8000) + ok 76 - len(mp_decode_int(-0x8000)) + ok 77 - len(mp_next_int(-0x8000)) + ok 78 - len(mp_check_int(-0x8000)) + ok 79 - mp_sizeof_int(-0x8000) + ok 80 - mp_encode(-0x8000) == "\xd1\x80\x00" + # int -0x8001 + ok 81 - mp_decode(mp_encode(-0x8001)) == -0x8001 + ok 82 - mp_check_int(-0x8001) + ok 83 - len(mp_encode_int(-0x8001) + ok 84 - len(mp_decode_int(-0x8001)) + ok 85 - len(mp_next_int(-0x8001)) + ok 86 - len(mp_check_int(-0x8001)) + ok 87 - mp_sizeof_int(-0x8001) + ok 88 - mp_encode(-0x8001) == "\xd2\xff\xff\x7f\xff" + # int -0x7fffffff + ok 89 - mp_decode(mp_encode(-0x7fffffff)) == -0x7fffffff + ok 90 - mp_check_int(-0x7fffffff) + ok 91 - len(mp_encode_int(-0x7fffffff) + ok 92 - len(mp_decode_int(-0x7fffffff)) + ok 93 - len(mp_next_int(-0x7fffffff)) + ok 94 - len(mp_check_int(-0x7fffffff)) + ok 95 - mp_sizeof_int(-0x7fffffff) + ok 96 - mp_encode(-0x7fffffff) == "\xd2\x80\x00\x00\x01" + # int -0x80000000L + ok 97 - mp_decode(mp_encode(-0x80000000L)) == -0x80000000L + ok 98 - mp_check_int(-0x80000000L) + ok 99 - len(mp_encode_int(-0x80000000L) + ok 100 - len(mp_decode_int(-0x80000000L)) + ok 101 - len(mp_next_int(-0x80000000L)) + ok 102 - len(mp_check_int(-0x80000000L)) + ok 103 - mp_sizeof_int(-0x80000000L) + ok 104 - mp_encode(-0x80000000L) == "\xd2\x80\x00\x00\x00" + # int -0x80000001L + ok 105 - mp_decode(mp_encode(-0x80000001L)) == -0x80000001L + ok 106 - mp_check_int(-0x80000001L) + ok 107 - len(mp_encode_int(-0x80000001L) + ok 108 - len(mp_decode_int(-0x80000001L)) + ok 109 - len(mp_next_int(-0x80000001L)) + ok 110 - len(mp_check_int(-0x80000001L)) + ok 111 - mp_sizeof_int(-0x80000001L) + ok 112 - mp_encode(-0x80000001L) == "\xd3\xff\xff\xff\xff\x7f\xff\xff\xff" + # int -0x80000001L + ok 113 - mp_decode(mp_encode(-0x80000001L)) == -0x80000001L + ok 114 - mp_check_int(-0x80000001L) + ok 115 - len(mp_encode_int(-0x80000001L) + ok 116 - len(mp_decode_int(-0x80000001L)) + ok 117 - len(mp_next_int(-0x80000001L)) + ok 118 - len(mp_check_int(-0x80000001L)) + ok 119 - mp_sizeof_int(-0x80000001L) + ok 120 - mp_encode(-0x80000001L) == "\xd3\xff\xff\xff\xff\x7f\xff\xff\xff" + # int -0x7fffffffffffffffL + ok 121 - mp_decode(mp_encode(-0x7fffffffffffffffL)) == -0x7fffffffffffffffL + ok 122 - mp_check_int(-0x7fffffffffffffffL) + ok 123 - len(mp_encode_int(-0x7fffffffffffffffL) + ok 124 - len(mp_decode_int(-0x7fffffffffffffffL)) + ok 125 - len(mp_next_int(-0x7fffffffffffffffL)) + ok 126 - len(mp_check_int(-0x7fffffffffffffffL)) + ok 127 - mp_sizeof_int(-0x7fffffffffffffffL) + ok 128 - mp_encode(-0x7fffffffffffffffL) == "\xd3\x80\x00\x00\x00\x00\x00\x00\x01" + # int -0x8000000000000000L + ok 129 - mp_decode(mp_encode(-0x8000000000000000L)) == -0x8000000000000000L + ok 130 - mp_check_int(-0x8000000000000000L) + ok 131 - len(mp_encode_int(-0x8000000000000000L) + ok 132 - len(mp_decode_int(-0x8000000000000000L)) + ok 133 - len(mp_next_int(-0x8000000000000000L)) + ok 134 - len(mp_check_int(-0x8000000000000000L)) + ok 135 - mp_sizeof_int(-0x8000000000000000L) + ok 136 - mp_encode(-0x8000000000000000L) == "\xd3\x80\x00\x00\x00\x00\x00\x00\x00" + # *** test_ints: done *** +ok 2 - subtests + 1..16 + # *** test_bools *** + # bool 1 + ok 1 - mp_decode(mp_encode(1)) == 1 + ok 2 - mp_check_bool(1) + ok 3 - len(mp_encode_bool(1) + ok 4 - len(mp_decode_bool(1)) + ok 5 - len(mp_next_bool(1)) + ok 6 - len(mp_check_bool(1)) + ok 7 - mp_sizeof_bool(1) + ok 8 - mp_encode(1) == "\xc3" + # bool 0 + ok 9 - mp_decode(mp_encode(0)) == 0 + ok 10 - mp_check_bool(0) + ok 11 - len(mp_encode_bool(0) + ok 12 - len(mp_decode_bool(0)) + ok 13 - len(mp_next_bool(0)) + ok 14 - len(mp_check_bool(0)) + ok 15 - mp_sizeof_bool(0) + ok 16 - mp_encode(0) == "\xc2" + # *** test_bools: done *** +ok 3 - subtests + 1..24 + # *** test_floats *** + # float 1.0f + ok 1 - mp_decode(mp_encode(1.0f)) == 1.0f + ok 2 - mp_check_float(1.0f) + ok 3 - len(mp_encode_float(1.0f) + ok 4 - len(mp_decode_float(1.0f)) + ok 5 - len(mp_next_float(1.0f)) + ok 6 - len(mp_check_float(1.0f)) + ok 7 - mp_sizeof_float(1.0f) + ok 8 - mp_encode(1.0f) == "\xca\x3f\x80\x00\x00" + # float 3.141592653589793f + ok 9 - mp_decode(mp_encode(3.141592653589793f)) == 3.141592653589793f + ok 10 - mp_check_float(3.141592653589793f) + ok 11 - len(mp_encode_float(3.141592653589793f) + ok 12 - len(mp_decode_float(3.141592653589793f)) + ok 13 - len(mp_next_float(3.141592653589793f)) + ok 14 - len(mp_check_float(3.141592653589793f)) + ok 15 - mp_sizeof_float(3.141592653589793f) + ok 16 - mp_encode(3.141592653589793f) == "\xca\x40\x49\x0f\xdb" + # float -1e38f + ok 17 - mp_decode(mp_encode(-1e38f)) == -1e38f + ok 18 - mp_check_float(-1e38f) + ok 19 - len(mp_encode_float(-1e38f) + ok 20 - len(mp_decode_float(-1e38f)) + ok 21 - len(mp_next_float(-1e38f)) + ok 22 - len(mp_check_float(-1e38f)) + ok 23 - mp_sizeof_float(-1e38f) + ok 24 - mp_encode(-1e38f) == "\xca\xfe\x96\x76\x99" + # *** test_floats: done *** +ok 4 - subtests + 1..24 + # *** test_doubles *** + # double 1.0 + ok 1 - mp_decode(mp_encode(1.0)) == 1.0 + ok 2 - mp_check_double(1.0) + ok 3 - len(mp_encode_double(1.0) + ok 4 - len(mp_decode_double(1.0)) + ok 5 - len(mp_next_double(1.0)) + ok 6 - len(mp_check_double(1.0)) + ok 7 - mp_sizeof_double(1.0) + ok 8 - mp_encode(1.0) == "\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00" + # double 3.141592653589793 + ok 9 - mp_decode(mp_encode(3.141592653589793)) == 3.141592653589793 + ok 10 - mp_check_double(3.141592653589793) + ok 11 - len(mp_encode_double(3.141592653589793) + ok 12 - len(mp_decode_double(3.141592653589793)) + ok 13 - len(mp_next_double(3.141592653589793)) + ok 14 - len(mp_check_double(3.141592653589793)) + ok 15 - mp_sizeof_double(3.141592653589793) + ok 16 - mp_encode(3.141592653589793) == "\xcb\x40\x09\x21\xfb\x54\x44\x2d\x18" + # double -1e99 + ok 17 - mp_decode(mp_encode(-1e99)) == -1e99 + ok 18 - mp_check_double(-1e99) + ok 19 - len(mp_encode_double(-1e99) + ok 20 - len(mp_decode_double(-1e99)) + ok 21 - len(mp_next_double(-1e99)) + ok 22 - len(mp_check_double(-1e99)) + ok 23 - mp_sizeof_double(-1e99) + ok 24 - mp_encode(-1e99) == "\xcb\xd4\x7d\x42\xae\xa2\x87\x9f\x2e" + # *** test_doubles: done *** +ok 5 - subtests + 1..6 + # *** test_nils *** + # nil + ok 1 - mp_check_nil() + ok 2 - len(mp_encode_nil() == 1 + ok 3 - len(mp_decode_nil()) == 1 + ok 4 - len(mp_next_nil()) == 1 + ok 5 - len(mp_check_nil()) == 1 + ok 6 - mp_sizeof_nil() == 1 + # *** test_nils: done *** +ok 6 - subtests + 1..65 + # *** test_strls *** + # strl 0x00U + ok 1 - mp_decode(mp_encode(0x00U)) == 0x00U + ok 2 - len(mp_encode_strl(0x00U) + ok 3 - len(mp_decode_strl(0x00U)) + ok 4 - mp_sizeof_strl(0x00U) + ok 5 - mp_encode(0x00U) == "\xa0" + # strl 0x01U + ok 6 - mp_decode(mp_encode(0x01U)) == 0x01U + ok 7 - len(mp_encode_strl(0x01U) + ok 8 - len(mp_decode_strl(0x01U)) + ok 9 - mp_sizeof_strl(0x01U) + ok 10 - mp_encode(0x01U) == "\xa1" + # strl 0x1eU + ok 11 - mp_decode(mp_encode(0x1eU)) == 0x1eU + ok 12 - len(mp_encode_strl(0x1eU) + ok 13 - len(mp_decode_strl(0x1eU)) + ok 14 - mp_sizeof_strl(0x1eU) + ok 15 - mp_encode(0x1eU) == "\xbe" + # strl 0x1fU + ok 16 - mp_decode(mp_encode(0x1fU)) == 0x1fU + ok 17 - len(mp_encode_strl(0x1fU) + ok 18 - len(mp_decode_strl(0x1fU)) + ok 19 - mp_sizeof_strl(0x1fU) + ok 20 - mp_encode(0x1fU) == "\xbf" + # strl 0x20U + ok 21 - mp_decode(mp_encode(0x20U)) == 0x20U + ok 22 - len(mp_encode_strl(0x20U) + ok 23 - len(mp_decode_strl(0x20U)) + ok 24 - mp_sizeof_strl(0x20U) + ok 25 - mp_encode(0x20U) == "\xd9\x20" + # strl 0xfeU + ok 26 - mp_decode(mp_encode(0xfeU)) == 0xfeU + ok 27 - len(mp_encode_strl(0xfeU) + ok 28 - len(mp_decode_strl(0xfeU)) + ok 29 - mp_sizeof_strl(0xfeU) + ok 30 - mp_encode(0xfeU) == "\xd9\xfe" + # strl 0xffU + ok 31 - mp_decode(mp_encode(0xffU)) == 0xffU + ok 32 - len(mp_encode_strl(0xffU) + ok 33 - len(mp_decode_strl(0xffU)) + ok 34 - mp_sizeof_strl(0xffU) + ok 35 - mp_encode(0xffU) == "\xd9\xff" + # strl 0x0100U + ok 36 - mp_decode(mp_encode(0x0100U)) == 0x0100U + ok 37 - len(mp_encode_strl(0x0100U) + ok 38 - len(mp_decode_strl(0x0100U)) + ok 39 - mp_sizeof_strl(0x0100U) + ok 40 - mp_encode(0x0100U) == "\xda\x01\x00" + # strl 0xfffeU + ok 41 - mp_decode(mp_encode(0xfffeU)) == 0xfffeU + ok 42 - len(mp_encode_strl(0xfffeU) + ok 43 - len(mp_decode_strl(0xfffeU)) + ok 44 - mp_sizeof_strl(0xfffeU) + ok 45 - mp_encode(0xfffeU) == "\xda\xff\xfe" + # strl 0xffffU + ok 46 - mp_decode(mp_encode(0xffffU)) == 0xffffU + ok 47 - len(mp_encode_strl(0xffffU) + ok 48 - len(mp_decode_strl(0xffffU)) + ok 49 - mp_sizeof_strl(0xffffU) + ok 50 - mp_encode(0xffffU) == "\xda\xff\xff" + # strl 0x00010000U + ok 51 - mp_decode(mp_encode(0x00010000U)) == 0x00010000U + ok 52 - len(mp_encode_strl(0x00010000U) + ok 53 - len(mp_decode_strl(0x00010000U)) + ok 54 - mp_sizeof_strl(0x00010000U) + ok 55 - mp_encode(0x00010000U) == "\xdb\x00\x01\x00\x00" + # strl 0xfffffffeU + ok 56 - mp_decode(mp_encode(0xfffffffeU)) == 0xfffffffeU + ok 57 - len(mp_encode_strl(0xfffffffeU) + ok 58 - len(mp_decode_strl(0xfffffffeU)) + ok 59 - mp_sizeof_strl(0xfffffffeU) + ok 60 - mp_encode(0xfffffffeU) == "\xdb\xff\xff\xff\xfe" + # strl 0xffffffffU + ok 61 - mp_decode(mp_encode(0xffffffffU)) == 0xffffffffU + ok 62 - len(mp_encode_strl(0xffffffffU) + ok 63 - len(mp_decode_strl(0xffffffffU)) + ok 64 - mp_sizeof_strl(0xffffffffU) + ok 65 - mp_encode(0xffffffffU) == "\xdb\xff\xff\xff\xff" + # *** test_strls: done *** +ok 7 - subtests + 1..65 + # *** test_binls *** + # binl 0x00U + ok 1 - mp_decode(mp_encode(0x00U)) == 0x00U + ok 2 - len(mp_encode_binl(0x00U) + ok 3 - len(mp_decode_binl(0x00U)) + ok 4 - mp_sizeof_binl(0x00U) + ok 5 - mp_encode(0x00U) == "\xc4\x00" + # binl 0x01U + ok 6 - mp_decode(mp_encode(0x01U)) == 0x01U + ok 7 - len(mp_encode_binl(0x01U) + ok 8 - len(mp_decode_binl(0x01U)) + ok 9 - mp_sizeof_binl(0x01U) + ok 10 - mp_encode(0x01U) == "\xc4\x01" + # binl 0x1eU + ok 11 - mp_decode(mp_encode(0x1eU)) == 0x1eU + ok 12 - len(mp_encode_binl(0x1eU) + ok 13 - len(mp_decode_binl(0x1eU)) + ok 14 - mp_sizeof_binl(0x1eU) + ok 15 - mp_encode(0x1eU) == "\xc4\x1e" + # binl 0x1fU + ok 16 - mp_decode(mp_encode(0x1fU)) == 0x1fU + ok 17 - len(mp_encode_binl(0x1fU) + ok 18 - len(mp_decode_binl(0x1fU)) + ok 19 - mp_sizeof_binl(0x1fU) + ok 20 - mp_encode(0x1fU) == "\xc4\x1f" + # binl 0x20U + ok 21 - mp_decode(mp_encode(0x20U)) == 0x20U + ok 22 - len(mp_encode_binl(0x20U) + ok 23 - len(mp_decode_binl(0x20U)) + ok 24 - mp_sizeof_binl(0x20U) + ok 25 - mp_encode(0x20U) == "\xc4\x20" + # binl 0xfeU + ok 26 - mp_decode(mp_encode(0xfeU)) == 0xfeU + ok 27 - len(mp_encode_binl(0xfeU) + ok 28 - len(mp_decode_binl(0xfeU)) + ok 29 - mp_sizeof_binl(0xfeU) + ok 30 - mp_encode(0xfeU) == "\xc4\xfe" + # binl 0xffU + ok 31 - mp_decode(mp_encode(0xffU)) == 0xffU + ok 32 - len(mp_encode_binl(0xffU) + ok 33 - len(mp_decode_binl(0xffU)) + ok 34 - mp_sizeof_binl(0xffU) + ok 35 - mp_encode(0xffU) == "\xc4\xff" + # binl 0x0100U + ok 36 - mp_decode(mp_encode(0x0100U)) == 0x0100U + ok 37 - len(mp_encode_binl(0x0100U) + ok 38 - len(mp_decode_binl(0x0100U)) + ok 39 - mp_sizeof_binl(0x0100U) + ok 40 - mp_encode(0x0100U) == "\xc5\x01\x00" + # binl 0xfffeU + ok 41 - mp_decode(mp_encode(0xfffeU)) == 0xfffeU + ok 42 - len(mp_encode_binl(0xfffeU) + ok 43 - len(mp_decode_binl(0xfffeU)) + ok 44 - mp_sizeof_binl(0xfffeU) + ok 45 - mp_encode(0xfffeU) == "\xc5\xff\xfe" + # binl 0xffffU + ok 46 - mp_decode(mp_encode(0xffffU)) == 0xffffU + ok 47 - len(mp_encode_binl(0xffffU) + ok 48 - len(mp_decode_binl(0xffffU)) + ok 49 - mp_sizeof_binl(0xffffU) + ok 50 - mp_encode(0xffffU) == "\xc5\xff\xff" + # binl 0x00010000U + ok 51 - mp_decode(mp_encode(0x00010000U)) == 0x00010000U + ok 52 - len(mp_encode_binl(0x00010000U) + ok 53 - len(mp_decode_binl(0x00010000U)) + ok 54 - mp_sizeof_binl(0x00010000U) + ok 55 - mp_encode(0x00010000U) == "\xc6\x00\x01\x00\x00" + # binl 0xfffffffeU + ok 56 - mp_decode(mp_encode(0xfffffffeU)) == 0xfffffffeU + ok 57 - len(mp_encode_binl(0xfffffffeU) + ok 58 - len(mp_decode_binl(0xfffffffeU)) + ok 59 - mp_sizeof_binl(0xfffffffeU) + ok 60 - mp_encode(0xfffffffeU) == "\xc6\xff\xff\xff\xfe" + # binl 0xffffffffU + ok 61 - mp_decode(mp_encode(0xffffffffU)) == 0xffffffffU + ok 62 - len(mp_encode_binl(0xffffffffU) + ok 63 - len(mp_decode_binl(0xffffffffU)) + ok 64 - mp_sizeof_binl(0xffffffffU) + ok 65 - mp_encode(0xffffffffU) == "\xc6\xff\xff\xff\xff" + # *** test_binls: done *** +ok 8 - subtests + 1..84 + # *** test_strs *** + # str len=0x01 + ok 1 - len(mp_decode_str(x, 1)) + ok 2 - mp_check_str(mp_encode_str(x, 0x01)) + ok 3 - len(mp_decode_str(x, 0x01) + ok 4 - len(mp_next_str(x, 0x01) + ok 5 - len(mp_check_str(x, 0x01) + ok 6 - mp_sizeof_str(0x01) + ok 7 - mp_encode_str(x, 0x01) == x + # str len=0x1e + ok 8 - len(mp_decode_str(x, 30)) + ok 9 - mp_check_str(mp_encode_str(x, 0x1e)) + ok 10 - len(mp_decode_str(x, 0x1e) + ok 11 - len(mp_next_str(x, 0x1e) + ok 12 - len(mp_check_str(x, 0x1e) + ok 13 - mp_sizeof_str(0x1e) + ok 14 - mp_encode_str(x, 0x1e) == x + # str len=0x1f + ok 15 - len(mp_decode_str(x, 31)) + ok 16 - mp_check_str(mp_encode_str(x, 0x1f)) + ok 17 - len(mp_decode_str(x, 0x1f) + ok 18 - len(mp_next_str(x, 0x1f) + ok 19 - len(mp_check_str(x, 0x1f) + ok 20 - mp_sizeof_str(0x1f) + ok 21 - mp_encode_str(x, 0x1f) == x + # str len=0x20 + ok 22 - len(mp_decode_str(x, 32)) + ok 23 - mp_check_str(mp_encode_str(x, 0x20)) + ok 24 - len(mp_decode_str(x, 0x20) + ok 25 - len(mp_next_str(x, 0x20) + ok 26 - len(mp_check_str(x, 0x20) + ok 27 - mp_sizeof_str(0x20) + ok 28 - mp_encode_str(x, 0x20) == x + # str len=0xfe + ok 29 - len(mp_decode_str(x, 254)) + ok 30 - mp_check_str(mp_encode_str(x, 0xfe)) + ok 31 - len(mp_decode_str(x, 0xfe) + ok 32 - len(mp_next_str(x, 0xfe) + ok 33 - len(mp_check_str(x, 0xfe) + ok 34 - mp_sizeof_str(0xfe) + ok 35 - mp_encode_str(x, 0xfe) == x + # str len=0xff + ok 36 - len(mp_decode_str(x, 255)) + ok 37 - mp_check_str(mp_encode_str(x, 0xff)) + ok 38 - len(mp_decode_str(x, 0xff) + ok 39 - len(mp_next_str(x, 0xff) + ok 40 - len(mp_check_str(x, 0xff) + ok 41 - mp_sizeof_str(0xff) + ok 42 - mp_encode_str(x, 0xff) == x + # str len=0x100 + ok 43 - len(mp_decode_str(x, 256)) + ok 44 - mp_check_str(mp_encode_str(x, 0x100)) + ok 45 - len(mp_decode_str(x, 0x100) + ok 46 - len(mp_next_str(x, 0x100) + ok 47 - len(mp_check_str(x, 0x100) + ok 48 - mp_sizeof_str(0x100) + ok 49 - mp_encode_str(x, 0x100) == x + # str len=0x101 + ok 50 - len(mp_decode_str(x, 257)) + ok 51 - mp_check_str(mp_encode_str(x, 0x101)) + ok 52 - len(mp_decode_str(x, 0x101) + ok 53 - len(mp_next_str(x, 0x101) + ok 54 - len(mp_check_str(x, 0x101) + ok 55 - mp_sizeof_str(0x101) + ok 56 - mp_encode_str(x, 0x101) == x + # str len=0xfffe + ok 57 - len(mp_decode_str(x, 65534)) + ok 58 - mp_check_str(mp_encode_str(x, 0xfffe)) + ok 59 - len(mp_decode_str(x, 0xfffe) + ok 60 - len(mp_next_str(x, 0xfffe) + ok 61 - len(mp_check_str(x, 0xfffe) + ok 62 - mp_sizeof_str(0xfffe) + ok 63 - mp_encode_str(x, 0xfffe) == x + # str len=0xffff + ok 64 - len(mp_decode_str(x, 65535)) + ok 65 - mp_check_str(mp_encode_str(x, 0xffff)) + ok 66 - len(mp_decode_str(x, 0xffff) + ok 67 - len(mp_next_str(x, 0xffff) + ok 68 - len(mp_check_str(x, 0xffff) + ok 69 - mp_sizeof_str(0xffff) + ok 70 - mp_encode_str(x, 0xffff) == x + # str len=0x10000 + ok 71 - len(mp_decode_str(x, 65536)) + ok 72 - mp_check_str(mp_encode_str(x, 0x10000)) + ok 73 - len(mp_decode_str(x, 0x10000) + ok 74 - len(mp_next_str(x, 0x10000) + ok 75 - len(mp_check_str(x, 0x10000) + ok 76 - mp_sizeof_str(0x10000) + ok 77 - mp_encode_str(x, 0x10000) == x + # str len=0x10001 + ok 78 - len(mp_decode_str(x, 65537)) + ok 79 - mp_check_str(mp_encode_str(x, 0x10001)) + ok 80 - len(mp_decode_str(x, 0x10001) + ok 81 - len(mp_next_str(x, 0x10001) + ok 82 - len(mp_check_str(x, 0x10001) + ok 83 - mp_sizeof_str(0x10001) + ok 84 - mp_encode_str(x, 0x10001) == x + # *** test_strs: done *** +ok 9 - subtests + 1..84 + # *** test_bins *** + # bin len=0x01 + ok 1 - len(mp_decode_bin(x, 1)) + ok 2 - mp_check_bin(mp_encode_bin(x, 0x01)) + ok 3 - len(mp_decode_bin(x, 0x01) + ok 4 - len(mp_next_bin(x, 0x01) + ok 5 - len(mp_check_bin(x, 0x01) + ok 6 - mp_sizeof_bin(0x01) + ok 7 - mp_encode_bin(x, 0x01) == x + # bin len=0x1e + ok 8 - len(mp_decode_bin(x, 30)) + ok 9 - mp_check_bin(mp_encode_bin(x, 0x1e)) + ok 10 - len(mp_decode_bin(x, 0x1e) + ok 11 - len(mp_next_bin(x, 0x1e) + ok 12 - len(mp_check_bin(x, 0x1e) + ok 13 - mp_sizeof_bin(0x1e) + ok 14 - mp_encode_bin(x, 0x1e) == x + # bin len=0x1f + ok 15 - len(mp_decode_bin(x, 31)) + ok 16 - mp_check_bin(mp_encode_bin(x, 0x1f)) + ok 17 - len(mp_decode_bin(x, 0x1f) + ok 18 - len(mp_next_bin(x, 0x1f) + ok 19 - len(mp_check_bin(x, 0x1f) + ok 20 - mp_sizeof_bin(0x1f) + ok 21 - mp_encode_bin(x, 0x1f) == x + # bin len=0x20 + ok 22 - len(mp_decode_bin(x, 32)) + ok 23 - mp_check_bin(mp_encode_bin(x, 0x20)) + ok 24 - len(mp_decode_bin(x, 0x20) + ok 25 - len(mp_next_bin(x, 0x20) + ok 26 - len(mp_check_bin(x, 0x20) + ok 27 - mp_sizeof_bin(0x20) + ok 28 - mp_encode_bin(x, 0x20) == x + # bin len=0xfe + ok 29 - len(mp_decode_bin(x, 254)) + ok 30 - mp_check_bin(mp_encode_bin(x, 0xfe)) + ok 31 - len(mp_decode_bin(x, 0xfe) + ok 32 - len(mp_next_bin(x, 0xfe) + ok 33 - len(mp_check_bin(x, 0xfe) + ok 34 - mp_sizeof_bin(0xfe) + ok 35 - mp_encode_bin(x, 0xfe) == x + # bin len=0xff + ok 36 - len(mp_decode_bin(x, 255)) + ok 37 - mp_check_bin(mp_encode_bin(x, 0xff)) + ok 38 - len(mp_decode_bin(x, 0xff) + ok 39 - len(mp_next_bin(x, 0xff) + ok 40 - len(mp_check_bin(x, 0xff) + ok 41 - mp_sizeof_bin(0xff) + ok 42 - mp_encode_bin(x, 0xff) == x + # bin len=0x100 + ok 43 - len(mp_decode_bin(x, 256)) + ok 44 - mp_check_bin(mp_encode_bin(x, 0x100)) + ok 45 - len(mp_decode_bin(x, 0x100) + ok 46 - len(mp_next_bin(x, 0x100) + ok 47 - len(mp_check_bin(x, 0x100) + ok 48 - mp_sizeof_bin(0x100) + ok 49 - mp_encode_bin(x, 0x100) == x + # bin len=0x101 + ok 50 - len(mp_decode_bin(x, 257)) + ok 51 - mp_check_bin(mp_encode_bin(x, 0x101)) + ok 52 - len(mp_decode_bin(x, 0x101) + ok 53 - len(mp_next_bin(x, 0x101) + ok 54 - len(mp_check_bin(x, 0x101) + ok 55 - mp_sizeof_bin(0x101) + ok 56 - mp_encode_bin(x, 0x101) == x + # bin len=0xfffe + ok 57 - len(mp_decode_bin(x, 65534)) + ok 58 - mp_check_bin(mp_encode_bin(x, 0xfffe)) + ok 59 - len(mp_decode_bin(x, 0xfffe) + ok 60 - len(mp_next_bin(x, 0xfffe) + ok 61 - len(mp_check_bin(x, 0xfffe) + ok 62 - mp_sizeof_bin(0xfffe) + ok 63 - mp_encode_bin(x, 0xfffe) == x + # bin len=0xffff + ok 64 - len(mp_decode_bin(x, 65535)) + ok 65 - mp_check_bin(mp_encode_bin(x, 0xffff)) + ok 66 - len(mp_decode_bin(x, 0xffff) + ok 67 - len(mp_next_bin(x, 0xffff) + ok 68 - len(mp_check_bin(x, 0xffff) + ok 69 - mp_sizeof_bin(0xffff) + ok 70 - mp_encode_bin(x, 0xffff) == x + # bin len=0x10000 + ok 71 - len(mp_decode_bin(x, 65536)) + ok 72 - mp_check_bin(mp_encode_bin(x, 0x10000)) + ok 73 - len(mp_decode_bin(x, 0x10000) + ok 74 - len(mp_next_bin(x, 0x10000) + ok 75 - len(mp_check_bin(x, 0x10000) + ok 76 - mp_sizeof_bin(0x10000) + ok 77 - mp_encode_bin(x, 0x10000) == x + # bin len=0x10001 + ok 78 - len(mp_decode_bin(x, 65537)) + ok 79 - mp_check_bin(mp_encode_bin(x, 0x10001)) + ok 80 - len(mp_decode_bin(x, 0x10001) + ok 81 - len(mp_next_bin(x, 0x10001) + ok 82 - len(mp_check_bin(x, 0x10001) + ok 83 - mp_sizeof_bin(0x10001) + ok 84 - mp_encode_bin(x, 0x10001) == x + # *** test_bins: done *** +ok 10 - subtests + 1..45 + # *** test_arrays *** + # array 0 + ok 1 - mp_decode(mp_encode(0)) == 0 + ok 2 - len(mp_encode_array(0) + ok 3 - len(mp_decode_array(0)) + ok 4 - mp_sizeof_array(0) + ok 5 - mp_encode(0) == "\x90" + # array 1 + ok 6 - mp_decode(mp_encode(1)) == 1 + ok 7 - len(mp_encode_array(1) + ok 8 - len(mp_decode_array(1)) + ok 9 - mp_sizeof_array(1) + ok 10 - mp_encode(1) == "\x91" + # array 15 + ok 11 - mp_decode(mp_encode(15)) == 15 + ok 12 - len(mp_encode_array(15) + ok 13 - len(mp_decode_array(15)) + ok 14 - mp_sizeof_array(15) + ok 15 - mp_encode(15) == "\x9f" + # array 16 + ok 16 - mp_decode(mp_encode(16)) == 16 + ok 17 - len(mp_encode_array(16) + ok 18 - len(mp_decode_array(16)) + ok 19 - mp_sizeof_array(16) + ok 20 - mp_encode(16) == "\xdc\x00\x10" + # array (65535) - 1 + ok 21 - mp_decode(mp_encode((65535) - 1)) == (65535) - 1 + ok 22 - len(mp_encode_array((65535) - 1) + ok 23 - len(mp_decode_array((65535) - 1)) + ok 24 - mp_sizeof_array((65535) - 1) + ok 25 - mp_encode((65535) - 1) == "\xdc\xff\xfe" + # array (65535) + ok 26 - mp_decode(mp_encode((65535))) == (65535) + ok 27 - len(mp_encode_array((65535)) + ok 28 - len(mp_decode_array((65535))) + ok 29 - mp_sizeof_array((65535)) + ok 30 - mp_encode((65535)) == "\xdc\xff\xff" + # array (65535) + 1 + ok 31 - mp_decode(mp_encode((65535) + 1)) == (65535) + 1 + ok 32 - len(mp_encode_array((65535) + 1) + ok 33 - len(mp_decode_array((65535) + 1)) + ok 34 - mp_sizeof_array((65535) + 1) + ok 35 - mp_encode((65535) + 1) == "\xdd\x00\x01\x00\x00" + # array (4294967295U) - 1 + ok 36 - mp_decode(mp_encode((4294967295U) - 1)) == (4294967295U) - 1 + ok 37 - len(mp_encode_array((4294967295U) - 1) + ok 38 - len(mp_decode_array((4294967295U) - 1)) + ok 39 - mp_sizeof_array((4294967295U) - 1) + ok 40 - mp_encode((4294967295U) - 1) == "\xdd\xff\xff\xff\xfe" + # array (4294967295U) + ok 41 - mp_decode(mp_encode((4294967295U))) == (4294967295U) + ok 42 - len(mp_encode_array((4294967295U)) + ok 43 - len(mp_decode_array((4294967295U))) + ok 44 - mp_sizeof_array((4294967295U)) + ok 45 - mp_encode((4294967295U)) == "\xdd\xff\xff\xff\xff" + # *** test_arrays: done *** +ok 11 - subtests + 1..45 + # *** test_maps *** + # map 0 + ok 1 - mp_decode(mp_encode(0)) == 0 + ok 2 - len(mp_encode_map(0) + ok 3 - len(mp_decode_map(0)) + ok 4 - mp_sizeof_map(0) + ok 5 - mp_encode(0) == "\x80" + # map 1 + ok 6 - mp_decode(mp_encode(1)) == 1 + ok 7 - len(mp_encode_map(1) + ok 8 - len(mp_decode_map(1)) + ok 9 - mp_sizeof_map(1) + ok 10 - mp_encode(1) == "\x81" + # map 15 + ok 11 - mp_decode(mp_encode(15)) == 15 + ok 12 - len(mp_encode_map(15) + ok 13 - len(mp_decode_map(15)) + ok 14 - mp_sizeof_map(15) + ok 15 - mp_encode(15) == "\x8f" + # map 16 + ok 16 - mp_decode(mp_encode(16)) == 16 + ok 17 - len(mp_encode_map(16) + ok 18 - len(mp_decode_map(16)) + ok 19 - mp_sizeof_map(16) + ok 20 - mp_encode(16) == "\xde\x00\x10" + # map (65535) - 1 + ok 21 - mp_decode(mp_encode((65535) - 1)) == (65535) - 1 + ok 22 - len(mp_encode_map((65535) - 1) + ok 23 - len(mp_decode_map((65535) - 1)) + ok 24 - mp_sizeof_map((65535) - 1) + ok 25 - mp_encode((65535) - 1) == "\xde\xff\xfe" + # map (65535) + ok 26 - mp_decode(mp_encode((65535))) == (65535) + ok 27 - len(mp_encode_map((65535)) + ok 28 - len(mp_decode_map((65535))) + ok 29 - mp_sizeof_map((65535)) + ok 30 - mp_encode((65535)) == "\xde\xff\xff" + # map (65535) + 1 + ok 31 - mp_decode(mp_encode((65535) + 1)) == (65535) + 1 + ok 32 - len(mp_encode_map((65535) + 1) + ok 33 - len(mp_decode_map((65535) + 1)) + ok 34 - mp_sizeof_map((65535) + 1) + ok 35 - mp_encode((65535) + 1) == "\xdf\x00\x01\x00\x00" + # map (4294967295U) - 1 + ok 36 - mp_decode(mp_encode((4294967295U) - 1)) == (4294967295U) - 1 + ok 37 - len(mp_encode_map((4294967295U) - 1) + ok 38 - len(mp_decode_map((4294967295U) - 1)) + ok 39 - mp_sizeof_map((4294967295U) - 1) + ok 40 - mp_encode((4294967295U) - 1) == "\xdf\xff\xff\xff\xfe" + # map (4294967295U) + ok 41 - mp_decode(mp_encode((4294967295U))) == (4294967295U) + ok 42 - len(mp_encode_map((4294967295U)) + ok 43 - len(mp_decode_map((4294967295U))) + ok 44 - mp_sizeof_map((4294967295U)) + ok 45 - mp_encode((4294967295U)) == "\xdf\xff\xff\xff\xff" + # *** test_maps: done *** +ok 12 - subtests + 1..52 + # *** test_next_on_arrays *** + # next/check on array(0) + ok 1 - mp_check(array 0)) + ok 2 - len(array 0) == 1 + ok 3 - len(mp_check(array 0)) == 1 + ok 4 - len(mp_next(array 0)) == 1 + # next/check on array(1) + ok 5 - mp_check(array 1)) + ok 6 - len(array 1) == 2 + ok 7 - len(mp_check(array 1)) == 2 + ok 8 - len(mp_next(array 1)) == 2 + # next/check on array(15) + ok 9 - mp_check(array 15)) + ok 10 - len(array 15) == 16 + ok 11 - len(mp_check(array 15)) == 16 + ok 12 - len(mp_next(array 15)) == 16 + # next/check on array(16) + ok 13 - mp_check(array 16)) + ok 14 - len(array 16) == 19 + ok 15 - len(mp_check(array 16)) == 19 + ok 16 - len(mp_next(array 16)) == 19 + # next/check on array(17) + ok 17 - mp_check(array 17)) + ok 18 - len(array 17) == 20 + ok 19 - len(mp_check(array 17)) == 20 + ok 20 - len(mp_next(array 17)) == 20 + # next/check on array(254) + ok 21 - mp_check(array 254)) + ok 22 - len(array 254) == 257 + ok 23 - len(mp_check(array 254)) == 257 + ok 24 - len(mp_next(array 254)) == 257 + # next/check on array(255) + ok 25 - mp_check(array 255)) + ok 26 - len(array 255) == 258 + ok 27 - len(mp_check(array 255)) == 258 + ok 28 - len(mp_next(array 255)) == 258 + # next/check on array(256) + ok 29 - mp_check(array 256)) + ok 30 - len(array 256) == 259 + ok 31 - len(mp_check(array 256)) == 259 + ok 32 - len(mp_next(array 256)) == 259 + # next/check on array(257) + ok 33 - mp_check(array 257)) + ok 34 - len(array 257) == 260 + ok 35 - len(mp_check(array 257)) == 260 + ok 36 - len(mp_next(array 257)) == 260 + # next/check on array(65534) + ok 37 - mp_check(array 65534)) + ok 38 - len(array 65534) == 65537 + ok 39 - len(mp_check(array 65534)) == 65537 + ok 40 - len(mp_next(array 65534)) == 65537 + # next/check on array(65535) + ok 41 - mp_check(array 65535)) + ok 42 - len(array 65535) == 65538 + ok 43 - len(mp_check(array 65535)) == 65538 + ok 44 - len(mp_next(array 65535)) == 65538 + # next/check on array(65536) + ok 45 - mp_check(array 65536)) + ok 46 - len(array 65536) == 65541 + ok 47 - len(mp_check(array 65536)) == 65541 + ok 48 - len(mp_next(array 65536)) == 65541 + # next/check on array(65537) + ok 49 - mp_check(array 65537)) + ok 50 - len(array 65537) == 65542 + ok 51 - len(mp_check(array 65537)) == 65542 + ok 52 - len(mp_next(array 65537)) == 65542 + # *** test_next_on_arrays: done *** +ok 13 - subtests + 1..52 + # *** test_next_on_maps *** + # next/check on map(0) + ok 1 - mp_check(map 0)) + ok 2 - len(map 0) == 1 + ok 3 - len(mp_check(map 0)) == 1 + ok 4 - len(mp_next(map 0)) == 1 + # next/check on map(1) + ok 5 - mp_check(map 1)) + ok 6 - len(map 1) == 3 + ok 7 - len(mp_check(map 1)) == 3 + ok 8 - len(mp_next(map 1)) == 3 + # next/check on map(15) + ok 9 - mp_check(map 15)) + ok 10 - len(map 15) == 31 + ok 11 - len(mp_check(map 15)) == 31 + ok 12 - len(mp_next(map 15)) == 31 + # next/check on map(16) + ok 13 - mp_check(map 16)) + ok 14 - len(map 16) == 35 + ok 15 - len(mp_check(map 16)) == 35 + ok 16 - len(mp_next(map 16)) == 35 + # next/check on map(17) + ok 17 - mp_check(map 17)) + ok 18 - len(map 17) == 37 + ok 19 - len(mp_check(map 17)) == 37 + ok 20 - len(mp_next(map 17)) == 37 + # next/check on map(254) + ok 21 - mp_check(map 254)) + ok 22 - len(map 254) == 511 + ok 23 - len(mp_check(map 254)) == 511 + ok 24 - len(mp_next(map 254)) == 511 + # next/check on map(255) + ok 25 - mp_check(map 255)) + ok 26 - len(map 255) == 513 + ok 27 - len(mp_check(map 255)) == 513 + ok 28 - len(mp_next(map 255)) == 513 + # next/check on map(256) + ok 29 - mp_check(map 256)) + ok 30 - len(map 256) == 515 + ok 31 - len(mp_check(map 256)) == 515 + ok 32 - len(mp_next(map 256)) == 515 + # next/check on map(257) + ok 33 - mp_check(map 257)) + ok 34 - len(map 257) == 517 + ok 35 - len(mp_check(map 257)) == 517 + ok 36 - len(mp_next(map 257)) == 517 + # next/check on map(65534) + ok 37 - mp_check(map 65534)) + ok 38 - len(map 65534) == 131071 + ok 39 - len(mp_check(map 65534)) == 131071 + ok 40 - len(mp_next(map 65534)) == 131071 + # next/check on map(65535) + ok 41 - mp_check(map 65535)) + ok 42 - len(map 65535) == 131073 + ok 43 - len(mp_check(map 65535)) == 131073 + ok 44 - len(mp_next(map 65535)) == 131073 + # next/check on map(65536) + ok 45 - mp_check(map 65536)) + ok 46 - len(map 65536) == 131077 + ok 47 - len(mp_check(map 65536)) == 131077 + ok 48 - len(mp_next(map 65536)) == 131077 + # next/check on map(65537) + ok 49 - mp_check(map 65537)) + ok 50 - len(map 65537) == 131079 + ok 51 - len(mp_check(map 65537)) == 131079 + ok 52 - len(mp_next(map 65537)) == 131079 + # *** test_next_on_maps: done *** +ok 14 - subtests + 1..227 + # *** test_compare_uints *** + ok 1 - mp_compare_uint(0, 0) == 0 + ok 2 - mp_compare_uint(0, 0) == 0 + ok 3 - mp_compare_uint(0, 0) == 0 + ok 4 - mp_compare_uint(0, 1) < 0 + ok 5 - mp_compare_uint(0, 126) < 0 + ok 6 - mp_compare_uint(0, 127) < 0 + ok 7 - mp_compare_uint(0, 128) < 0 + ok 8 - mp_compare_uint(0, 254) < 0 + ok 9 - mp_compare_uint(0, 255) < 0 + ok 10 - mp_compare_uint(0, 65534) < 0 + ok 11 - mp_compare_uint(0, 65535) < 0 + ok 12 - mp_compare_uint(0, 65536) < 0 + ok 13 - mp_compare_uint(0, 4294967294) < 0 + ok 14 - mp_compare_uint(0, 4294967295) < 0 + ok 15 - mp_compare_uint(0, 4294967296) < 0 + ok 16 - mp_compare_uint(0, 18446744073709551614) < 0 + ok 17 - mp_compare_uint(0, 18446744073709551615) < 0 + ok 18 - mp_compare_uint(1, 0) > 0 + ok 19 - mp_compare_uint(1, 1) == 0 + ok 20 - mp_compare_uint(1, 126) < 0 + ok 21 - mp_compare_uint(1, 127) < 0 + ok 22 - mp_compare_uint(1, 128) < 0 + ok 23 - mp_compare_uint(1, 254) < 0 + ok 24 - mp_compare_uint(1, 255) < 0 + ok 25 - mp_compare_uint(1, 65534) < 0 + ok 26 - mp_compare_uint(1, 65535) < 0 + ok 27 - mp_compare_uint(1, 65536) < 0 + ok 28 - mp_compare_uint(1, 4294967294) < 0 + ok 29 - mp_compare_uint(1, 4294967295) < 0 + ok 30 - mp_compare_uint(1, 4294967296) < 0 + ok 31 - mp_compare_uint(1, 18446744073709551614) < 0 + ok 32 - mp_compare_uint(1, 18446744073709551615) < 0 + ok 33 - mp_compare_uint(126, 0) > 0 + ok 34 - mp_compare_uint(126, 1) > 0 + ok 35 - mp_compare_uint(126, 126) == 0 + ok 36 - mp_compare_uint(126, 127) < 0 + ok 37 - mp_compare_uint(126, 128) < 0 + ok 38 - mp_compare_uint(126, 254) < 0 + ok 39 - mp_compare_uint(126, 255) < 0 + ok 40 - mp_compare_uint(126, 65534) < 0 + ok 41 - mp_compare_uint(126, 65535) < 0 + ok 42 - mp_compare_uint(126, 65536) < 0 + ok 43 - mp_compare_uint(126, 4294967294) < 0 + ok 44 - mp_compare_uint(126, 4294967295) < 0 + ok 45 - mp_compare_uint(126, 4294967296) < 0 + ok 46 - mp_compare_uint(126, 18446744073709551614) < 0 + ok 47 - mp_compare_uint(126, 18446744073709551615) < 0 + ok 48 - mp_compare_uint(127, 0) > 0 + ok 49 - mp_compare_uint(127, 1) > 0 + ok 50 - mp_compare_uint(127, 126) > 0 + ok 51 - mp_compare_uint(127, 127) == 0 + ok 52 - mp_compare_uint(127, 128) < 0 + ok 53 - mp_compare_uint(127, 254) < 0 + ok 54 - mp_compare_uint(127, 255) < 0 + ok 55 - mp_compare_uint(127, 65534) < 0 + ok 56 - mp_compare_uint(127, 65535) < 0 + ok 57 - mp_compare_uint(127, 65536) < 0 + ok 58 - mp_compare_uint(127, 4294967294) < 0 + ok 59 - mp_compare_uint(127, 4294967295) < 0 + ok 60 - mp_compare_uint(127, 4294967296) < 0 + ok 61 - mp_compare_uint(127, 18446744073709551614) < 0 + ok 62 - mp_compare_uint(127, 18446744073709551615) < 0 + ok 63 - mp_compare_uint(128, 0) > 0 + ok 64 - mp_compare_uint(128, 1) > 0 + ok 65 - mp_compare_uint(128, 126) > 0 + ok 66 - mp_compare_uint(128, 127) > 0 + ok 67 - mp_compare_uint(128, 128) == 0 + ok 68 - mp_compare_uint(128, 254) < 0 + ok 69 - mp_compare_uint(128, 255) < 0 + ok 70 - mp_compare_uint(128, 65534) < 0 + ok 71 - mp_compare_uint(128, 65535) < 0 + ok 72 - mp_compare_uint(128, 65536) < 0 + ok 73 - mp_compare_uint(128, 4294967294) < 0 + ok 74 - mp_compare_uint(128, 4294967295) < 0 + ok 75 - mp_compare_uint(128, 4294967296) < 0 + ok 76 - mp_compare_uint(128, 18446744073709551614) < 0 + ok 77 - mp_compare_uint(128, 18446744073709551615) < 0 + ok 78 - mp_compare_uint(254, 0) > 0 + ok 79 - mp_compare_uint(254, 1) > 0 + ok 80 - mp_compare_uint(254, 126) > 0 + ok 81 - mp_compare_uint(254, 127) > 0 + ok 82 - mp_compare_uint(254, 128) > 0 + ok 83 - mp_compare_uint(254, 254) == 0 + ok 84 - mp_compare_uint(254, 255) < 0 + ok 85 - mp_compare_uint(254, 65534) < 0 + ok 86 - mp_compare_uint(254, 65535) < 0 + ok 87 - mp_compare_uint(254, 65536) < 0 + ok 88 - mp_compare_uint(254, 4294967294) < 0 + ok 89 - mp_compare_uint(254, 4294967295) < 0 + ok 90 - mp_compare_uint(254, 4294967296) < 0 + ok 91 - mp_compare_uint(254, 18446744073709551614) < 0 + ok 92 - mp_compare_uint(254, 18446744073709551615) < 0 + ok 93 - mp_compare_uint(255, 0) > 0 + ok 94 - mp_compare_uint(255, 1) > 0 + ok 95 - mp_compare_uint(255, 126) > 0 + ok 96 - mp_compare_uint(255, 127) > 0 + ok 97 - mp_compare_uint(255, 128) > 0 + ok 98 - mp_compare_uint(255, 254) > 0 + ok 99 - mp_compare_uint(255, 255) == 0 + ok 100 - mp_compare_uint(255, 65534) < 0 + ok 101 - mp_compare_uint(255, 65535) < 0 + ok 102 - mp_compare_uint(255, 65536) < 0 + ok 103 - mp_compare_uint(255, 4294967294) < 0 + ok 104 - mp_compare_uint(255, 4294967295) < 0 + ok 105 - mp_compare_uint(255, 4294967296) < 0 + ok 106 - mp_compare_uint(255, 18446744073709551614) < 0 + ok 107 - mp_compare_uint(255, 18446744073709551615) < 0 + ok 108 - mp_compare_uint(65534, 0) > 0 + ok 109 - mp_compare_uint(65534, 1) > 0 + ok 110 - mp_compare_uint(65534, 126) > 0 + ok 111 - mp_compare_uint(65534, 127) > 0 + ok 112 - mp_compare_uint(65534, 128) > 0 + ok 113 - mp_compare_uint(65534, 254) > 0 + ok 114 - mp_compare_uint(65534, 255) > 0 + ok 115 - mp_compare_uint(65534, 65534) == 0 + ok 116 - mp_compare_uint(65534, 65535) < 0 + ok 117 - mp_compare_uint(65534, 65536) < 0 + ok 118 - mp_compare_uint(65534, 4294967294) < 0 + ok 119 - mp_compare_uint(65534, 4294967295) < 0 + ok 120 - mp_compare_uint(65534, 4294967296) < 0 + ok 121 - mp_compare_uint(65534, 18446744073709551614) < 0 + ok 122 - mp_compare_uint(65534, 18446744073709551615) < 0 + ok 123 - mp_compare_uint(65535, 0) > 0 + ok 124 - mp_compare_uint(65535, 1) > 0 + ok 125 - mp_compare_uint(65535, 126) > 0 + ok 126 - mp_compare_uint(65535, 127) > 0 + ok 127 - mp_compare_uint(65535, 128) > 0 + ok 128 - mp_compare_uint(65535, 254) > 0 + ok 129 - mp_compare_uint(65535, 255) > 0 + ok 130 - mp_compare_uint(65535, 65534) > 0 + ok 131 - mp_compare_uint(65535, 65535) == 0 + ok 132 - mp_compare_uint(65535, 65536) < 0 + ok 133 - mp_compare_uint(65535, 4294967294) < 0 + ok 134 - mp_compare_uint(65535, 4294967295) < 0 + ok 135 - mp_compare_uint(65535, 4294967296) < 0 + ok 136 - mp_compare_uint(65535, 18446744073709551614) < 0 + ok 137 - mp_compare_uint(65535, 18446744073709551615) < 0 + ok 138 - mp_compare_uint(65536, 0) > 0 + ok 139 - mp_compare_uint(65536, 1) > 0 + ok 140 - mp_compare_uint(65536, 126) > 0 + ok 141 - mp_compare_uint(65536, 127) > 0 + ok 142 - mp_compare_uint(65536, 128) > 0 + ok 143 - mp_compare_uint(65536, 254) > 0 + ok 144 - mp_compare_uint(65536, 255) > 0 + ok 145 - mp_compare_uint(65536, 65534) > 0 + ok 146 - mp_compare_uint(65536, 65535) > 0 + ok 147 - mp_compare_uint(65536, 65536) == 0 + ok 148 - mp_compare_uint(65536, 4294967294) < 0 + ok 149 - mp_compare_uint(65536, 4294967295) < 0 + ok 150 - mp_compare_uint(65536, 4294967296) < 0 + ok 151 - mp_compare_uint(65536, 18446744073709551614) < 0 + ok 152 - mp_compare_uint(65536, 18446744073709551615) < 0 + ok 153 - mp_compare_uint(4294967294, 0) > 0 + ok 154 - mp_compare_uint(4294967294, 1) > 0 + ok 155 - mp_compare_uint(4294967294, 126) > 0 + ok 156 - mp_compare_uint(4294967294, 127) > 0 + ok 157 - mp_compare_uint(4294967294, 128) > 0 + ok 158 - mp_compare_uint(4294967294, 254) > 0 + ok 159 - mp_compare_uint(4294967294, 255) > 0 + ok 160 - mp_compare_uint(4294967294, 65534) > 0 + ok 161 - mp_compare_uint(4294967294, 65535) > 0 + ok 162 - mp_compare_uint(4294967294, 65536) > 0 + ok 163 - mp_compare_uint(4294967294, 4294967294) == 0 + ok 164 - mp_compare_uint(4294967294, 4294967295) < 0 + ok 165 - mp_compare_uint(4294967294, 4294967296) < 0 + ok 166 - mp_compare_uint(4294967294, 18446744073709551614) < 0 + ok 167 - mp_compare_uint(4294967294, 18446744073709551615) < 0 + ok 168 - mp_compare_uint(4294967295, 0) > 0 + ok 169 - mp_compare_uint(4294967295, 1) > 0 + ok 170 - mp_compare_uint(4294967295, 126) > 0 + ok 171 - mp_compare_uint(4294967295, 127) > 0 + ok 172 - mp_compare_uint(4294967295, 128) > 0 + ok 173 - mp_compare_uint(4294967295, 254) > 0 + ok 174 - mp_compare_uint(4294967295, 255) > 0 + ok 175 - mp_compare_uint(4294967295, 65534) > 0 + ok 176 - mp_compare_uint(4294967295, 65535) > 0 + ok 177 - mp_compare_uint(4294967295, 65536) > 0 + ok 178 - mp_compare_uint(4294967295, 4294967294) > 0 + ok 179 - mp_compare_uint(4294967295, 4294967295) == 0 + ok 180 - mp_compare_uint(4294967295, 4294967296) < 0 + ok 181 - mp_compare_uint(4294967295, 18446744073709551614) < 0 + ok 182 - mp_compare_uint(4294967295, 18446744073709551615) < 0 + ok 183 - mp_compare_uint(4294967296, 0) > 0 + ok 184 - mp_compare_uint(4294967296, 1) > 0 + ok 185 - mp_compare_uint(4294967296, 126) > 0 + ok 186 - mp_compare_uint(4294967296, 127) > 0 + ok 187 - mp_compare_uint(4294967296, 128) > 0 + ok 188 - mp_compare_uint(4294967296, 254) > 0 + ok 189 - mp_compare_uint(4294967296, 255) > 0 + ok 190 - mp_compare_uint(4294967296, 65534) > 0 + ok 191 - mp_compare_uint(4294967296, 65535) > 0 + ok 192 - mp_compare_uint(4294967296, 65536) > 0 + ok 193 - mp_compare_uint(4294967296, 4294967294) > 0 + ok 194 - mp_compare_uint(4294967296, 4294967295) > 0 + ok 195 - mp_compare_uint(4294967296, 4294967296) == 0 + ok 196 - mp_compare_uint(4294967296, 18446744073709551614) < 0 + ok 197 - mp_compare_uint(4294967296, 18446744073709551615) < 0 + ok 198 - mp_compare_uint(18446744073709551614, 0) > 0 + ok 199 - mp_compare_uint(18446744073709551614, 1) > 0 + ok 200 - mp_compare_uint(18446744073709551614, 126) > 0 + ok 201 - mp_compare_uint(18446744073709551614, 127) > 0 + ok 202 - mp_compare_uint(18446744073709551614, 128) > 0 + ok 203 - mp_compare_uint(18446744073709551614, 254) > 0 + ok 204 - mp_compare_uint(18446744073709551614, 255) > 0 + ok 205 - mp_compare_uint(18446744073709551614, 65534) > 0 + ok 206 - mp_compare_uint(18446744073709551614, 65535) > 0 + ok 207 - mp_compare_uint(18446744073709551614, 65536) > 0 + ok 208 - mp_compare_uint(18446744073709551614, 4294967294) > 0 + ok 209 - mp_compare_uint(18446744073709551614, 4294967295) > 0 + ok 210 - mp_compare_uint(18446744073709551614, 4294967296) > 0 + ok 211 - mp_compare_uint(18446744073709551614, 18446744073709551614) == 0 + ok 212 - mp_compare_uint(18446744073709551614, 18446744073709551615) < 0 + ok 213 - mp_compare_uint(18446744073709551615, 0) > 0 + ok 214 - mp_compare_uint(18446744073709551615, 1) > 0 + ok 215 - mp_compare_uint(18446744073709551615, 126) > 0 + ok 216 - mp_compare_uint(18446744073709551615, 127) > 0 + ok 217 - mp_compare_uint(18446744073709551615, 128) > 0 + ok 218 - mp_compare_uint(18446744073709551615, 254) > 0 + ok 219 - mp_compare_uint(18446744073709551615, 255) > 0 + ok 220 - mp_compare_uint(18446744073709551615, 65534) > 0 + ok 221 - mp_compare_uint(18446744073709551615, 65535) > 0 + ok 222 - mp_compare_uint(18446744073709551615, 65536) > 0 + ok 223 - mp_compare_uint(18446744073709551615, 4294967294) > 0 + ok 224 - mp_compare_uint(18446744073709551615, 4294967295) > 0 + ok 225 - mp_compare_uint(18446744073709551615, 4294967296) > 0 + ok 226 - mp_compare_uint(18446744073709551615, 18446744073709551614) > 0 + ok 227 - mp_compare_uint(18446744073709551615, 18446744073709551615) == 0 + # *** test_compare_uints: done *** +ok 15 - subtests diff --git a/test/unit/tpeval.result b/test/unit/tpeval.result new file mode 100644 index 0000000000000000000000000000000000000000..13531bd313c1781e32c6a5745a502c12e4362600 --- /dev/null +++ b/test/unit/tpeval.result @@ -0,0 +1,111 @@ +1..110 +ok 1 - Parser didn't return results +ok 2 - Parser returned results +ok 3 - first token +ok 4 - token.type +ok 5 - token->len +ok 6 - Parser returned results +ok 7 - token length +ok 8 - first token +ok 9 - token.type +ok 10 - token->len +ok 11 - 2 tokens found +ok 12 - Parser returned results +ok 13 - first token +ok 14 - token.type +ok 15 - token->len +ok 16 - last token +ok 17 - token.type +ok 18 - token->len +ok 19 - 0 token found +ok 20 - 1 token found +ok 21 - token.str +ok 22 - token.type +ok 23 - token->len +ok 24 - 1 token found +ok 25 - token.str +ok 26 - token.type +ok 27 - token->len +ok 28 - 1 token found +ok 29 - token.str +ok 30 - token.type +ok 31 - token->len +ok 32 - 1 token found +ok 33 - token.str +ok 34 - token.type +ok 35 - token->len +ok 36 - token.str +ok 37 - token.type +ok 38 - token->len +ok 39 - 1 token found +ok 40 - token.str +ok 41 - token.type +ok 42 - token->len +ok 43 - token.str +ok 44 - token.type +ok 45 - token->len +ok 46 - token.str +ok 47 - token.type +ok 48 - token->len +ok 49 - 1 token found +ok 50 - token.str +ok 51 - token.type +ok 52 - token->len +ok 53 - token.str +ok 54 - token.type +ok 55 - token->len +ok 56 - token.str +ok 57 - token.type +ok 58 - token->len +ok 59 - 1 token found +ok 60 - token.str +ok 61 - token.type +ok 62 - token->len +ok 63 - token.str +ok 64 - token.type +ok 65 - token->len +ok 66 - token.str +ok 67 - token.type +ok 68 - token->len +ok 69 - token.str +ok 70 - token.type +ok 71 - token->len +ok 72 - 0 tokens found +ok 73 - 1 token found +ok 74 - token.str +ok 75 - token.type +ok 76 - token->len +ok 77 - 3 tokens found +ok 78 - token.str +ok 79 - token.type +ok 80 - token->len +ok 81 - token.str +ok 82 - token.type +ok 83 - token->len +ok 84 - token.str +ok 85 - token.type +ok 86 - token->len +ok 87 - 3 tokens found +ok 88 - token.str +ok 89 - token.type +ok 90 - token->len +ok 91 - token.str +ok 92 - token.type +ok 93 - token->len +ok 94 - token.str +ok 95 - token.type +ok 96 - token->len +ok 97 - 2 tokens found +ok 98 - token.str +ok 99 - token.type +ok 100 - token->len +ok 101 - token.str +ok 102 - token.type +ok 103 - token->len +ok 104 - 2 tokens found +ok 105 - token.str +ok 106 - token.type +ok 107 - token->len +ok 108 - token.str +ok 109 - token.type +ok 110 - token->len