text:
#include "test-expect.h"

#if MPACK_EXPECT

static const char test_example[] = "\x82\xA7""compact\xC3\xA6""schema\x00";
#define TEST_EXAMPLE_SIZE (sizeof(test_example) - 1)

static void test_expect_example_read() {
    mpack_reader_t reader;
    mpack_reader_init_data(&reader, test_example, TEST_EXAMPLE_SIZE);

    // tests the example on the messagepack homepage using fixed
    // ordering for keys (mpack_expect_key_cstr_basic() tests re-ordering)
    TEST_TRUE(2 == mpack_expect_map(&reader));
    mpack_expect_cstr_match(&reader, "compact");
    TEST_TRUE(true == mpack_expect_bool(&reader));
    mpack_expect_cstr_match(&reader, "schema");
    TEST_TRUE(0 == mpack_expect_u8(&reader));
    mpack_done_map(&reader);

    TEST_READER_DESTROY_NOERROR(&reader);
}

/*
   [
   1,-32,128,-129,65536,-65537,2147483649,-2147483648,9223372036854775807,-9223372036854775808,
   ]
   */

static void test_expect_uint_fixnum() {

    // positive fixnums with u8
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_u8(&reader));

    // positive fixnums with u16
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_u16(&reader));

    // positive fixnums with u32
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_u32(&reader));

    // positive fixnums with u64
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_u64(&reader));

}

static void test_expect_uint_signed_fixnum() {

    // positive fixnums with i8
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_i8(&reader));

    // positive fixnums with i16
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_i16(&reader));

    // positive fixnums with i32
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_i32(&reader));

    // positive fixnums with i64
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\x0f", 0x0f == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\x10", 0x10 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\x7f", 0x7f == mpack_expect_i64(&reader));

}

static void test_expect_negative_fixnum() {

    // negative fixnums with i8
    TEST_SIMPLE_READ("\xff", -1 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\xfe", -2 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\xf0", -16 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\xe0", -32 == mpack_expect_i8(&reader));

    // negative fixnums with i16
    TEST_SIMPLE_READ("\xff", -1 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xfe", -2 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xf0", -16 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xe0", -32 == mpack_expect_i16(&reader));

    // negative fixnums with i32
    TEST_SIMPLE_READ("\xff", -1 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xfe", -2 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xf0", -16 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xe0", -32 == mpack_expect_i32(&reader));

    // negative fixnums with i64
    TEST_SIMPLE_READ("\xff", -1 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xfe", -2 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xf0", -16 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xe0", -32 == mpack_expect_i64(&reader));

}

static void test_expect_uint() {

    // positive signed into u8
    TEST_SIMPLE_READ("\xd0\x7f", 0x7f == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\xd0\x7f", 0x7f == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xd0\x7f", 0x7f == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xd0\x7f", 0x7f == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xd0\x7f", 0x7f == mpack_expect_uint(&reader));
    TEST_SIMPLE_READ("\xd1\x7f\xff", 0x7fff == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xd1\x7f\xff", 0x7fff == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xd1\x7f\xff", 0x7fff == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xd1\x7f\xff", 0x7fff == mpack_expect_uint(&reader));
    TEST_SIMPLE_READ("\xd2\x7f\xff\xff\xff", 0x7fffffff == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xd2\x7f\xff\xff\xff", 0x7fffffff == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xd2\x7f\xff\xff\xff", 0x7fffffff == mpack_expect_uint(&reader));
    TEST_SIMPLE_READ("\xd3\x7f\xff\xff\xff\xff\xff\xff\xff", 0x7fffffffffffffff == mpack_expect_u64(&reader));

    // positive unsigned into u8

    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_u8(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_u16(&reader));
    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", 0xffffffff == mpack_expect_u32(&reader));
    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", 0xffffffff == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", 0xffffffff == mpack_expect_uint(&reader));

    TEST_SIMPLE_READ("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 0x100000000 == mpack_expect_u64(&reader));
    TEST_SIMPLE_READ("\xcf\xff\xff\xff\xff\xff\xff\xff\xff", 0xffffffffffffffff == mpack_expect_u64(&reader));

}

static void test_expect_uint_signed() {

    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xcc\x80", 0x80 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xcc\xff", 0xff == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xcd\x01\x00", 0x100 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xcd\xff\xff", 0xffff == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", 0x10000 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", 0xffffffff == mpack_expect_i64(&reader));

    TEST_SIMPLE_READ("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 0x100000000 == mpack_expect_i64(&reader));

}

static void test_expect_int() {

    TEST_SIMPLE_READ("\xd0\xdf", -33 == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\xd0\xdf", -33 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xd0\xdf", -33 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd0\xdf", -33 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd0\xdf", -33 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd0\x80", INT8_MIN == mpack_expect_i8(&reader));
    TEST_SIMPLE_READ("\xd0\x80", INT8_MIN == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xd0\x80", INT8_MIN == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd0\x80", INT8_MIN == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd0\x80", INT8_MIN == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd1\xff\x7f", INT8_MIN - 1 == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xd1\xff\x7f", INT8_MIN - 1 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd1\xff\x7f", INT8_MIN - 1 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd1\xff\x7f", INT8_MIN - 1 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd1\x80\x00", INT16_MIN == mpack_expect_i16(&reader));
    TEST_SIMPLE_READ("\xd1\x80\x00", INT16_MIN == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd1\x80\x00", INT16_MIN == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd1\x80\x00", INT16_MIN == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd2\xff\xff\x7f\xff", INT16_MIN - 1 == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd2\xff\xff\x7f\xff", INT16_MIN - 1 == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd2\xff\xff\x7f\xff", INT16_MIN - 1 == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd2\x80\x00\x00\x00", INT32_MIN == mpack_expect_i32(&reader));
    TEST_SIMPLE_READ("\xd2\x80\x00\x00\x00", INT32_MIN == mpack_expect_i64(&reader));
    TEST_SIMPLE_READ("\xd2\x80\x00\x00\x00", INT32_MIN == mpack_expect_int(&reader));

    TEST_SIMPLE_READ("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", (int64_t)INT32_MIN - 1 == mpack_expect_i64(&reader));

    TEST_SIMPLE_READ("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", INT64_MIN == mpack_expect_i64(&reader));

}

static void test_expect_ints_dynamic_int() {

    // we don't bother to test with different signed/unsigned value
    // functions; they are tested for equality in test-value.c

    // positive fixnums
    TEST_SIMPLE_READ("\x00", mpack_tag_equal(mpack_tag_uint(0), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\x01", mpack_tag_equal(mpack_tag_uint(1), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\x02", mpack_tag_equal(mpack_tag_uint(2), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\x0f", mpack_tag_equal(mpack_tag_uint(0x0f), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\x10", mpack_tag_equal(mpack_tag_uint(0x10), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\x7f", mpack_tag_equal(mpack_tag_uint(0x7f), mpack_read_tag(&reader)));

    // negative fixnums
    TEST_SIMPLE_READ("\xff", mpack_tag_equal(mpack_tag_int(-1), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xfe", mpack_tag_equal(mpack_tag_int(-2), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xf0", mpack_tag_equal(mpack_tag_int(-16), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xe0", mpack_tag_equal(mpack_tag_int(-32), mpack_read_tag(&reader)));

    // uints
    TEST_SIMPLE_READ("\xcc\x80", mpack_tag_equal(mpack_tag_uint(0x80), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xcc\xff", mpack_tag_equal(mpack_tag_uint(0xff), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xcd\x01\x00", mpack_tag_equal(mpack_tag_uint(0x100), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xcd\xff\xff", mpack_tag_equal(mpack_tag_uint(0xffff), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", mpack_tag_equal(mpack_tag_uint(0x10000), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", mpack_tag_equal(mpack_tag_uint(0xffffffff), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", mpack_tag_equal(mpack_tag_uint(UINT64_C(0x100000000)), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xcf\xff\xff\xff\xff\xff\xff\xff\xff", mpack_tag_equal(mpack_tag_uint(UINT64_C(0xffffffffffffffff)), mpack_read_tag(&reader)));

    // ints
    TEST_SIMPLE_READ("\xd0\xdf", mpack_tag_equal(mpack_tag_int(-33), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xd0\x80", mpack_tag_equal(mpack_tag_int(INT8_MIN), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xd1\xff\x7f", mpack_tag_equal(mpack_tag_int(INT8_MIN - 1), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xd1\x80\x00", mpack_tag_equal(mpack_tag_int(INT16_MIN), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xd2\xff\xff\x7f\xff", mpack_tag_equal(mpack_tag_int(INT16_MIN - 1), mpack_read_tag(&reader)));

    TEST_SIMPLE_READ("\xd2\x80\x00\x00\x00", mpack_tag_equal(mpack_tag_int(INT32_MIN), mpack_read_tag(&reader)));
    TEST_SIMPLE_READ("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", mpack_tag_equal(mpack_tag_int((int64_t)INT32_MIN - 1), mpack_read_tag(&reader)));

    TEST_SIMPLE_READ("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", mpack_tag_equal(mpack_tag_int(INT64_MIN), mpack_read_tag(&reader)));

}

static void test_expect_int_bounds() {

    TEST_SIMPLE_READ_ERROR("\xd1\xff\x7f", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd1\x80\x00", 0 == mpack_expect_i8(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xd2\xff\xff\x7f\xff", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd2\xff\xff\x7f\xff", 0 == mpack_expect_i16(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xd2\x80\x00\x00\x00", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd2\x80\x00\x00\x00", 0 == mpack_expect_i16(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", 0 == mpack_expect_i16(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", 0 == mpack_expect_i32(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", 0 == mpack_expect_i16(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", 0 == mpack_expect_i32(&reader), mpack_error_type);

}

static void test_expect_uint_bounds() {

    TEST_SIMPLE_READ_ERROR("\xcd\x01\x00", 0 == mpack_expect_u8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xcd\xff\xff", 0 == mpack_expect_u8(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xce\x00\x01\x00\x00", 0 == mpack_expect_u8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xce\x00\x01\x00\x00", 0 == mpack_expect_u16(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xce\xff\xff\xff\xff", 0 == mpack_expect_u8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xce\xff\xff\xff\xff", 0 == mpack_expect_u16(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 0 == mpack_expect_u8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 0 == mpack_expect_u16(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 0 == mpack_expect_u32(&reader), mpack_error_type);

}

#define TEST_EXPECT_UINT_RANGE(name) \
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_##name##_max(&reader, 0));                                  \
    TEST_SIMPLE_READ_ERROR("\x01", 0 == mpack_expect_##name##_max(&reader, 0), mpack_error_type);          \
                                                                                \
    TEST_SIMPLE_READ_ERROR("\x00", 1 == mpack_expect_##name##_range(&reader, 1, 3), mpack_error_type);     \
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_##name##_range(&reader, 1, 3));                             \
    TEST_SIMPLE_READ("\x02", 2 == mpack_expect_##name##_range(&reader, 1, 3));                             \
    TEST_SIMPLE_READ("\x03", 3 == mpack_expect_##name##_range(&reader, 1, 3));                             \
    TEST_SIMPLE_READ_ERROR("\x04", 1 == mpack_expect_##name##_range(&reader, 1, 3), mpack_error_type);     \
                                                                                \
    TEST_SIMPLE_READ_ASSERT("\x00", mpack_expect_##name##_range(reader, 1, 0));

#define TEST_EXPECT_INT_RANGE(name) \
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_##name##_max(&reader, 0));                                  \
    TEST_SIMPLE_READ_ERROR("\x01", 0 == mpack_expect_##name##_max(&reader, 0), mpack_error_type);          \
    TEST_SIMPLE_READ_ERROR("\xff", 0 == mpack_expect_##name##_max(&reader, 0), mpack_error_type);          \
                                                                                \
    TEST_SIMPLE_READ_ERROR("\xfe", -1 == mpack_expect_##name##_range(&reader, -1, 1), mpack_error_type);   \
    TEST_SIMPLE_READ("\xff", -1 == mpack_expect_##name##_range(&reader, -1, 1));                           \
    TEST_SIMPLE_READ("\x00", 0 == mpack_expect_##name##_range(&reader, -1, 1));                            \
    TEST_SIMPLE_READ("\x01", 1 == mpack_expect_##name##_range(&reader, -1, 1));                            \
    TEST_SIMPLE_READ_ERROR("\x02", -1 == mpack_expect_##name##_range(&reader, -1, 1), mpack_error_type);   \
                                                                                \
    TEST_SIMPLE_READ_ASSERT("\x00", mpack_expect_##name##_range(reader, 1, -1));

static void test_expect_int_range() {
    // these currently don't test anything involving the limits of
    // each data type; there doesn't seem to be much point in doing
    // so, since they all wrap the normal expect functions.
    TEST_EXPECT_UINT_RANGE(u8);
    TEST_EXPECT_UINT_RANGE(u16);
    TEST_EXPECT_UINT_RANGE(u32);
    TEST_EXPECT_UINT_RANGE(u64);
    TEST_EXPECT_UINT_RANGE(uint);
    TEST_EXPECT_INT_RANGE(i8);
    TEST_EXPECT_INT_RANGE(i16);
    TEST_EXPECT_INT_RANGE(i32);
    TEST_EXPECT_INT_RANGE(i64);
    TEST_EXPECT_INT_RANGE(int);
}

static void test_expect_int_match() {
    TEST_SIMPLE_READ("\x00", (mpack_expect_uint_match(&reader, 0), true));
    TEST_SIMPLE_READ("\x01", (mpack_expect_uint_match(&reader, 1), true));
    TEST_SIMPLE_READ("\xcc\x80", (mpack_expect_uint_match(&reader, 0x80), true));
    TEST_SIMPLE_READ("\xcc\xff", (mpack_expect_uint_match(&reader, 0xff), true));
    TEST_SIMPLE_READ("\xcd\x01\x00", (mpack_expect_uint_match(&reader, 0x100), true));
    TEST_SIMPLE_READ("\xcd\xff\xff", (mpack_expect_uint_match(&reader, 0xffff), true));
    TEST_SIMPLE_READ("\xce\x00\x01\x00\x00", (mpack_expect_uint_match(&reader, 0x10000), true));
    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", (mpack_expect_uint_match(&reader, 0xffffffff), true));
    TEST_SIMPLE_READ("\xce\xff\xff\xff\xff", (mpack_expect_uint_match(&reader, 0xffffffff), true));
    TEST_SIMPLE_READ("\xcf\x00\x00\x00\x01\x00\x00\x00\x00", (mpack_expect_uint_match(&reader, 0x100000000), true));
    TEST_SIMPLE_READ("\xcf\xff\xff\xff\xff\xff\xff\xff\xff", (mpack_expect_uint_match(&reader, 0xffffffffffffffff), true));
    TEST_SIMPLE_READ_ERROR("\xff", (mpack_expect_uint_match(&reader, 0), true), mpack_error_type);

    TEST_SIMPLE_READ("\x00", (mpack_expect_int_match(&reader, 0), true));
    TEST_SIMPLE_READ("\x01", (mpack_expect_int_match(&reader, 1), true));
    TEST_SIMPLE_READ("\xd0\xdf", (mpack_expect_int_match(&reader, -33), true));
    TEST_SIMPLE_READ("\xd0\x80", (mpack_expect_int_match(&reader, INT8_MIN), true));
    TEST_SIMPLE_READ("\xd1\xff\x7f", (mpack_expect_int_match(&reader, INT8_MIN - 1), true));
    TEST_SIMPLE_READ("\xd1\x80\x00", (mpack_expect_int_match(&reader, INT16_MIN), true));
    TEST_SIMPLE_READ("\xd2\xff\xff\x7f\xff", (mpack_expect_int_match(&reader, INT16_MIN - 1), true));
    TEST_SIMPLE_READ("\xd2\x80\x00\x00\x00", (mpack_expect_int_match(&reader, INT32_MIN), true));
    TEST_SIMPLE_READ("\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", (mpack_expect_int_match(&reader, (int64_t)INT32_MIN - 1), true));
    TEST_SIMPLE_READ("\xd3\x80\x00\x00\x00\x00\x00\x00\x00", (mpack_expect_int_match(&reader, INT64_MIN), true));
    TEST_SIMPLE_READ_ERROR("\xc0", (mpack_expect_int_match(&reader, 0), true), mpack_error_type);

}

static void test_expect_misc() {
    TEST_SIMPLE_READ("\xc0", (mpack_expect_nil(&reader), true));
    TEST_SIMPLE_READ("\xc0", (mpack_expect_tag(&reader, mpack_tag_nil()), true));
    TEST_SIMPLE_READ_ERROR("\x90", (mpack_expect_tag(&reader, mpack_tag_nil()), true), mpack_error_type);

    TEST_SIMPLE_READ("\xc2", false == mpack_expect_bool(&reader));
    TEST_SIMPLE_READ("\xc3", true == mpack_expect_bool(&reader));
    TEST_SIMPLE_READ("\xc2", (mpack_expect_false(&reader), true));
    TEST_SIMPLE_READ("\xc3", (mpack_expect_true(&reader), true));
    TEST_SIMPLE_READ_ERROR("\xc0", (mpack_expect_false(&reader), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", (mpack_expect_true(&reader), true), mpack_error_type);
}

#if MPACK_READ_TRACKING
static void test_expect_tracking() {
    char buf[4];
    mpack_reader_t reader;

    // tracking depth growth
    TEST_READER_INIT_STR(&reader, "\x91\x91\x91\x91\x91\x91\x90");
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(1 == mpack_expect_array(&reader));
    TEST_TRUE(0 == mpack_expect_array(&reader));
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    mpack_done_array(&reader);
    TEST_READER_DESTROY_NOERROR(&reader);

    // cancel
    TEST_READER_INIT_STR(&reader, "\x90");
    mpack_expect_array(&reader);
    mpack_reader_flag_error(&reader, mpack_error_data);
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_data);

    // done type when nothing was open
    TEST_READER_INIT_STR(&reader, "\x90");
    TEST_BREAK((mpack_done_map(&reader), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // closing incomplete type
    TEST_READER_INIT_STR(&reader, "\x91\xc0");
    mpack_expect_array(&reader);
    TEST_BREAK((mpack_done_array(&reader), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // reading elements in a string
    TEST_READER_INIT_STR(&reader, "\xa2""xx");
    mpack_expect_str(&reader);
    TEST_BREAK((mpack_read_tag(&reader), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // reading too many elements
    TEST_READER_INIT_STR(&reader, "\x90");
    mpack_expect_array(&reader);
    TEST_BREAK((mpack_read_tag(&reader), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // reading bytes with nothing open
    TEST_READER_INIT_STR(&reader, "\x90");
    TEST_BREAK((mpack_read_bytes(&reader, buf, sizeof(buf)), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // reading bytes in an array
    TEST_READER_INIT_STR(&reader, "\x90");
    mpack_expect_array(&reader);
    TEST_BREAK((mpack_read_bytes(&reader, buf, sizeof(buf)), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // reading too many bytes
    TEST_READER_INIT_STR(&reader, "\xa2""xx");
    mpack_expect_str(&reader);
    TEST_BREAK((mpack_read_bytes(&reader, buf, sizeof(buf)), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);

    // checking remaining bytes with unclosed type
    TEST_READER_INIT_STR(&reader, "\xa2""xx");
    mpack_expect_str(&reader);
    TEST_BREAK((mpack_reader_remaining(&reader, NULL), true));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_bug);
}
#endif

static void test_expect_reals() {
    // these are some very simple floats that don't really test IEEE 742 conformance;
    // this section could use some improvement

    TEST_SIMPLE_READ("\x00", 0.0f == mpack_expect_float(&reader));
    TEST_SIMPLE_READ("\xd0\x00", 0.0f == mpack_expect_float(&reader));
    TEST_SIMPLE_READ("\xca\x00\x00\x00\x00", 0.0f == mpack_expect_float(&reader));
    TEST_SIMPLE_READ("\xcb\x00\x00\x00\x00\x00\x00\x00\x00", 0.0f == mpack_expect_float(&reader));

    TEST_SIMPLE_READ("\x00", 0.0 == mpack_expect_double(&reader));
    TEST_SIMPLE_READ("\xd0\x00", 0.0 == mpack_expect_double(&reader));
    TEST_SIMPLE_READ("\xca\x00\x00\x00\x00", 0.0 == mpack_expect_double(&reader));
    TEST_SIMPLE_READ("\xcb\x00\x00\x00\x00\x00\x00\x00\x00", 0.0 == mpack_expect_double(&reader));

    TEST_SIMPLE_READ("\xca\x00\x00\x00\x00", 0.0f == mpack_expect_float_strict(&reader));
    TEST_SIMPLE_READ("\xca\x00\x00\x00\x00", 0.0 == mpack_expect_double_strict(&reader));
    TEST_SIMPLE_READ("\xcb\x00\x00\x00\x00\x00\x00\x00\x00", 0.0 == mpack_expect_double_strict(&reader));

    // when -ffinite-math-only is enabled, isnan() can always return false.
    // TODO: we should probably add at least a reader option to
    // generate an error on non-finite reals.
    #if !MPACK_FINITE_MATH
    TEST_SIMPLE_READ("\xca\xff\xff\xff\xff", isnanf(mpack_expect_float(&reader)) != 0);
    TEST_SIMPLE_READ("\xcb\xff\xff\xff\xff\xff\xff\xff\xff", isnanf(mpack_expect_float(&reader)) != 0);
    TEST_SIMPLE_READ("\xca\xff\xff\xff\xff", isnan(mpack_expect_double(&reader)) != 0);
    TEST_SIMPLE_READ("\xcb\xff\xff\xff\xff\xff\xff\xff\xff", isnan(mpack_expect_double(&reader)) != 0);
    TEST_SIMPLE_READ("\xca\xff\xff\xff\xff", 0 != isnanf(mpack_expect_float_strict(&reader)));
    TEST_SIMPLE_READ("\xca\xff\xff\xff\xff", 0 != isnan(mpack_expect_double_strict(&reader)));
    TEST_SIMPLE_READ("\xcb\xff\xff\xff\xff\xff\xff\xff\xff", isnan(mpack_expect_double_strict(&reader)));
    #endif

    TEST_SIMPLE_READ_ERROR("\x00", 0.0f == mpack_expect_float_strict(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd0\x00", 0.0f == mpack_expect_float_strict(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xcb\x00\x00\x00\x00\x00\x00\x00\x00", 0.0f == mpack_expect_float_strict(&reader), mpack_error_type);

    TEST_SIMPLE_READ_ERROR("\x00", 0.0 == mpack_expect_double_strict(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xd0\x00", 0.0 == mpack_expect_double_strict(&reader), mpack_error_type);
}

static void test_expect_reals_range() {
    TEST_SIMPLE_READ("\x00", 0.0f == mpack_expect_float_range(&reader, 0.0f, 0.0f));
    TEST_SIMPLE_READ("\x00", 0.0f == mpack_expect_float_range(&reader, 0.0f, 1.0f));
    TEST_SIMPLE_READ("\x00", 0.0f == mpack_expect_float_range(&reader, -1.0f, 0.0f));
    TEST_SIMPLE_READ_ERROR("\x00", 1.0f == mpack_expect_float_range(&reader, 1.0f, 2.0f), mpack_error_type);
    TEST_SIMPLE_READ_ASSERT("\x00", mpack_expect_float_range(reader, 1.0f, -1.0f));

    TEST_SIMPLE_READ("\x00", 0.0 == mpack_expect_double_range(&reader, 0.0, 0.0f));
    TEST_SIMPLE_READ("\x00", 0.0 == mpack_expect_double_range(&reader, 0.0, 1.0f));
    TEST_SIMPLE_READ("\x00", 0.0 == mpack_expect_double_range(&reader, -1.0, 0.0f));
    TEST_SIMPLE_READ_ERROR("\x00", 1.0 == mpack_expect_double_range(&reader, 1.0, 2.0f), mpack_error_type);
    TEST_SIMPLE_READ_ASSERT("\x00", mpack_expect_double_range(reader, 1.0, -1.0));
}

static void test_expect_bad_type() {
    // test that all reader functions correctly handle badly typed data
    TEST_SIMPLE_READ_ERROR("\xc2", (mpack_expect_nil(&reader), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", false == mpack_expect_bool(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_u8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_u16(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_u32(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_u64(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_i8(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_i16(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_i32(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0 == mpack_expect_i64(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0.0f == mpack_expect_float(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0.0 == mpack_expect_double(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0.0f == mpack_expect_float_strict(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc0", 0.0 == mpack_expect_double_strict(&reader), mpack_error_type);
}

static void test_expect_pre_error() {
    // test that all reader functinvalidns correctly handle pre-existing errors
    TEST_SIMPLE_READ_ERROR("", (mpack_expect_nil(&reader), true), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", false == mpack_expect_bool(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_u8(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_u16(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_u32(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_u64(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_i8(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_i16(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_i32(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0 == mpack_expect_i64(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0.0f == mpack_expect_float(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0.0 == mpack_expect_double(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0.0f == mpack_expect_float_strict(&reader), mpack_error_invalid);
    TEST_SIMPLE_READ_ERROR("", 0.0 == mpack_expect_double_strict(&reader), mpack_error_invalid);
}

static void test_expect_str() {
    char buf[256];
    #ifdef MPACK_MALLOC
    char* test = NULL;
    #endif

    // str

    TEST_SIMPLE_READ("\xa0", 0 == mpack_expect_str(&reader) && (mpack_done_str(&reader), true));
    TEST_SIMPLE_READ_CANCEL("\xbf", 31 == mpack_expect_str(&reader));
    TEST_SIMPLE_READ_CANCEL("\xd9\x80", 128 == mpack_expect_str(&reader)); // TODO: test str8 compatibility
    TEST_SIMPLE_READ_CANCEL("\xda\x80\x80", 0x8080 == mpack_expect_str(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdb\xff\xff\xff\xff", 0xffffffff == mpack_expect_str(&reader));

    TEST_SIMPLE_READ("\xa0", 0 == mpack_expect_str_buf(&reader, buf, 0));
    TEST_SIMPLE_READ("\xa0", 0 == mpack_expect_str_buf(&reader, buf, 4));
    TEST_SIMPLE_READ("\xa4test", 4 == mpack_expect_str_buf(&reader, buf, 4));
    TEST_SIMPLE_READ_ERROR("\xa5hello", 0 == mpack_expect_str_buf(&reader, buf, 4), mpack_error_too_big);
    TEST_SIMPLE_READ_ERROR("\xa8test", 0 == mpack_expect_str_buf(&reader, buf, sizeof(buf)), mpack_error_invalid);
    TEST_SIMPLE_READ("\xa1\x00", 1 == mpack_expect_str_buf(&reader, buf, 4));

    TEST_SIMPLE_READ("\xa0", (mpack_expect_str_length(&reader, 0), mpack_done_str(&reader), true));
    TEST_SIMPLE_READ_ERROR("\xa0", (mpack_expect_str_length(&reader, 4), true), mpack_error_type);
    TEST_SIMPLE_READ_CANCEL("\xa4", (mpack_expect_str_length(&reader, 4), true));
    TEST_SIMPLE_READ_ERROR("\xa5", (mpack_expect_str_length(&reader, 4), true), mpack_error_type);

    // cstr
    TEST_SIMPLE_READ_ASSERT("\xa0", mpack_expect_cstr(reader, buf, 0));
    TEST_SIMPLE_READ("\xa0", (mpack_expect_cstr(&reader, buf, 4), true));
    TEST_TRUE(strlen(buf) == 0);
    TEST_SIMPLE_READ("\xa4test", (mpack_expect_cstr(&reader, buf, 5), true));
    TEST_TRUE(strlen(buf) == 4);
    TEST_SIMPLE_READ_ERROR("\xa5hello", (mpack_expect_cstr(&reader, buf, 5), true), mpack_error_too_big);
    TEST_TRUE(strlen(buf) == 0);
    TEST_SIMPLE_READ("\xa5hello", (mpack_expect_cstr(&reader, buf, sizeof(buf)), true));
    TEST_TRUE(strlen(buf) == 5);
    TEST_SIMPLE_READ_ERROR("\xa5he\x0lo", (mpack_expect_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);

    #ifdef MPACK_MALLOC
    // cstr alloc
    TEST_SIMPLE_READ_BREAK("\xa0", NULL == mpack_expect_cstr_alloc(&reader, 0));
    TEST_SIMPLE_READ("\xa0", NULL != (test = mpack_expect_cstr_alloc(&reader, 4)));
    if (test) {
        TEST_TRUE(strlen(test) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ_ERROR("\xa4test", NULL == mpack_expect_cstr_alloc(&reader, 4), mpack_error_too_big);
    TEST_SIMPLE_READ("\xa4test", NULL != (test = mpack_expect_cstr_alloc(&reader, 5)));
    if (test) {
        TEST_TRUE(strlen(test) == 4);
        TEST_TRUE(memcmp(test, "test", 4) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ("\xa4test", NULL != (test = mpack_expect_cstr_alloc(&reader, SIZE_MAX)));
    if (test) {
        TEST_TRUE(strlen(test) == 4);
        TEST_TRUE(memcmp(test, "test", 4) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ_ERROR("\xa5he\00lo", NULL == mpack_expect_cstr_alloc(&reader, 256), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\x01", NULL == mpack_expect_cstr_alloc(&reader, 3), mpack_error_type);
    #endif

    // cstr match
    TEST_SIMPLE_READ("\xa0", (mpack_expect_cstr_match(&reader, ""), true));
    TEST_SIMPLE_READ("\xa3""abc", (mpack_expect_cstr_match(&reader, "abc"), true));
    TEST_SIMPLE_READ_ERROR("\xa0", (mpack_expect_cstr_match(&reader, "abc"), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xa3""abc", (mpack_expect_cstr_match(&reader, ""), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xa3""zbc", (mpack_expect_cstr_match(&reader, "abc"), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xa3""azc", (mpack_expect_cstr_match(&reader, "abc"), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xa3""abz", (mpack_expect_cstr_match(&reader, "abc"), true), mpack_error_type);

    // bin is never allowed to be read as str

    TEST_SIMPLE_READ_ERROR("\xc4\x10", 0 == mpack_expect_str(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xc4\x10", (mpack_expect_str_buf(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_TRUE(strlen(buf) == 0);
    TEST_SIMPLE_READ_ERROR("\xc4\x10", (mpack_expect_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_TRUE(strlen(buf) == 0);

    // utf-8

    // the first byte of each of these is the MessagePack object header
    const char utf8_null[]            = "\xa1\x00";
    const char utf8_valid[]           = "\xac \xCF\x80 \xe4\xb8\xad \xf0\xa0\x80\xb6";
    const char utf8_trimmed[]         = "\xa4\xf0\xa0\x80\xb6";
    const char utf8_invalid[]         = "\xa3 \x80 ";
    const char utf8_invalid_trimmed[] = "\xa1\xa0";
    const char utf8_truncated[]       = "\xa2\xf0\xa0";
    // we don't accept any of these UTF-8 variants; only pure UTF-8 is allowed.
    const char utf8_modified[]        = "\xa4 \xc0\x80 ";
    const char utf8_cesu8[]           = "\xa8 \xED\xA0\x81\xED\xB0\x80 ";
    const char utf8_wobbly[]          = "\xa5 \xED\xA0\x81 ";

    // utf8 str
    TEST_SIMPLE_READ("\xa0", 0 == mpack_expect_utf8(&reader, buf, 0));
    TEST_SIMPLE_READ("\xa0", 0 == mpack_expect_utf8(&reader, buf, 4));
    TEST_SIMPLE_READ("\xa4test", 4 == mpack_expect_utf8(&reader, buf, 4));
    TEST_SIMPLE_READ_ERROR("\xa5hello", 0 == mpack_expect_utf8(&reader, buf, 4), mpack_error_too_big);
    TEST_SIMPLE_READ(utf8_null, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true));
    TEST_SIMPLE_READ(utf8_valid, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true));
    TEST_SIMPLE_READ(utf8_trimmed, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true));
    TEST_SIMPLE_READ_ERROR(utf8_invalid, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_invalid_trimmed, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_truncated, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_modified, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_cesu8, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_wobbly, (mpack_expect_utf8(&reader, buf, sizeof(buf)), true), mpack_error_type);

    // utf8 cstr
    TEST_SIMPLE_READ_ASSERT("\xa0", mpack_expect_utf8_cstr(reader, buf, 0));
    TEST_SIMPLE_READ("\xa0", (mpack_expect_utf8_cstr(&reader, buf, 4), true));
    TEST_TRUE(strlen(buf) == 0);
    TEST_SIMPLE_READ("\xa4test", (mpack_expect_utf8_cstr(&reader, buf, 5), true));
    TEST_TRUE(strlen(buf) == 4);
    TEST_SIMPLE_READ_ERROR("\xa5hello", (mpack_expect_utf8_cstr(&reader, buf, 5), true), mpack_error_too_big);
    TEST_TRUE(strlen(buf) == 0);
    TEST_SIMPLE_READ_ERROR(utf8_null, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ(utf8_valid, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true));
    TEST_SIMPLE_READ(utf8_trimmed, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true));
    TEST_SIMPLE_READ_ERROR(utf8_invalid, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_invalid_trimmed, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_truncated, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_modified, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_cesu8, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_wobbly, (mpack_expect_utf8_cstr(&reader, buf, sizeof(buf)), true), mpack_error_type);

    #ifdef MPACK_MALLOC
    // utf8 cstr alloc
    TEST_SIMPLE_READ_BREAK("\xa0", NULL == mpack_expect_utf8_cstr_alloc(&reader, 0));
    TEST_SIMPLE_READ("\xa0", NULL != (test = mpack_expect_utf8_cstr_alloc(&reader, 4)));
    if (test) {
        TEST_TRUE(strlen(test) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ_ERROR("\xa4test", NULL == mpack_expect_utf8_cstr_alloc(&reader, 4), mpack_error_too_big);
    TEST_SIMPLE_READ("\xa4test", NULL != (test = mpack_expect_utf8_cstr_alloc(&reader, 5)));
    if (test) {
        TEST_TRUE(strlen(test) == 4);
        TEST_TRUE(memcmp(test, "test", 4) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ("\xa4test", NULL != (test = mpack_expect_utf8_cstr_alloc(&reader, SIZE_MAX)));
    if (test) {
        TEST_TRUE(strlen(test) == 4);
        TEST_TRUE(memcmp(test, "test", 4) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ_ERROR("\x01", NULL == mpack_expect_utf8_cstr_alloc(&reader, 3), mpack_error_type);

    TEST_SIMPLE_READ_ERROR(utf8_null, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ(utf8_valid, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true));
    MPACK_FREE(test);
    TEST_SIMPLE_READ(utf8_trimmed, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true));
    MPACK_FREE(test);
    TEST_SIMPLE_READ_ERROR(utf8_invalid, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_invalid_trimmed, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_truncated, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_modified, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_cesu8, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    TEST_SIMPLE_READ_ERROR(utf8_wobbly, ((test = mpack_expect_utf8_cstr_alloc(&reader, 256)), true), mpack_error_type);
    #endif

}

static void test_expect_bin() {
    char buf[256];

    TEST_SIMPLE_READ_CANCEL("\xc4\x80", 128 == mpack_expect_bin(&reader));
    TEST_SIMPLE_READ_CANCEL("\xc5\x80\x80", 0x8080 == mpack_expect_bin(&reader));
    TEST_SIMPLE_READ_CANCEL("\xc6\xff\xff\xff\xff", 0xffffffff == mpack_expect_bin(&reader));

    // TODO: test strict/compatibility modes. currently, we do not
    // support old MessagePack version compatibility; bin will not
    // accept str types.
    TEST_SIMPLE_READ_ERROR("\xbf", 0 == mpack_expect_bin(&reader), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\xbf", 0 == mpack_expect_bin_buf(&reader, buf, sizeof(buf)), mpack_error_type);

    TEST_SIMPLE_READ("\xc4\x00", 0 == mpack_expect_bin_buf(&reader, buf, 0));
    TEST_SIMPLE_READ("\xc4\x00", 0 == mpack_expect_bin_buf(&reader, buf, 4));
    TEST_SIMPLE_READ("\xc4\x04test", 4 == mpack_expect_bin_buf(&reader, buf, 4));
    TEST_SIMPLE_READ_ERROR("\xc4\x05hello", 0 == mpack_expect_bin_buf(&reader, buf, 4), mpack_error_too_big);
    TEST_SIMPLE_READ_ERROR("\xc4\x08hello", 0 == mpack_expect_bin_buf(&reader, buf, sizeof(buf)), mpack_error_invalid);
    TEST_SIMPLE_READ("\xc4\x01\x00", 1 == mpack_expect_bin_buf(&reader, buf, 4));

    TEST_SIMPLE_READ("\xc4\x00", (mpack_expect_bin_size(&reader, 0), mpack_done_bin(&reader), true));
    TEST_SIMPLE_READ_ERROR("\xc4\x00", (mpack_expect_bin_size(&reader, 4), true), mpack_error_type);
    TEST_SIMPLE_READ_CANCEL("\xc4\x04", (mpack_expect_bin_size(&reader, 4), true));
    TEST_SIMPLE_READ_ERROR("\xc4\x05", (mpack_expect_bin_size(&reader, 4), true), mpack_error_type);

    #ifdef MPACK_MALLOC
    size_t length;
    char* test = NULL;

    TEST_SIMPLE_READ("\xc4\x00", (NULL == mpack_expect_bin_alloc(&reader, 0, &length)));
    TEST_TRUE(length == 0);
    TEST_SIMPLE_READ("\xc4\x00", (NULL == mpack_expect_bin_alloc(&reader, 4, &length)));
    TEST_TRUE(length == 0);
    TEST_SIMPLE_READ("\xc4\x04test", NULL != (test = mpack_expect_bin_alloc(&reader, 4, &length)));
    if (test) {
        TEST_TRUE(length == 4);
        TEST_TRUE(memcmp(test, "test", 4) == 0);
        MPACK_FREE(test);
    }
    TEST_SIMPLE_READ_ERROR("\xc4\x04test", NULL == mpack_expect_bin_alloc(&reader, 3, &length), mpack_error_type);
    TEST_SIMPLE_READ_ERROR("\x01", NULL == mpack_expect_bin_alloc(&reader, 3, &length), mpack_error_type);
    #endif

}

static void test_expect_ext() {
}

static void test_expect_arrays() {
    uint32_t count;

    // arrays

    TEST_SIMPLE_READ_CANCEL("\x90", 0 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\x91", 1 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\x9f", 15 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdc\x00\x00", 0 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdc\x01\x00", 0x100 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdc\xff\xff", 0xffff == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdd\x00\x00\x00\x00", 0 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdd\x00\x00\x01\x00", 0x100 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdd\x00\x01\x00\x00", 0x10000 == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdd\xff\xff\xff\xff", UINT32_MAX == mpack_expect_array(&reader));
    TEST_SIMPLE_READ_ERROR("\x00", 0 == mpack_expect_array(&reader), mpack_error_type);

    // array ranges

    TEST_SIMPLE_READ_CANCEL("\x91", 1 == mpack_expect_array_range(&reader, 0, 1));
    TEST_SIMPLE_READ_CANCEL("\x91", 1 == mpack_expect_array_range(&reader, 1, 1));
    TEST_SIMPLE_READ_ERROR("\x91", 2 == mpack_expect_array_range(&reader, 2, 2), mpack_error_type);
    TEST_SIMPLE_READ_ASSERT("\x91", mpack_expect_array_range(reader, 2, 1));
    TEST_SIMPLE_READ_CANCEL("\x91", 1 == mpack_expect_array_max(&reader, 1));
    TEST_SIMPLE_READ_ERROR("\x91", 0 == mpack_expect_array_max(&reader, 0), mpack_error_type);

    TEST_SIMPLE_READ("\x90", (mpack_expect_array_match(&reader, 0), mpack_done_array(&reader), true));
    TEST_SIMPLE_READ_CANCEL("\x9f", (mpack_expect_array_match(&reader, 15), true));
    TEST_SIMPLE_READ_CANCEL("\xdc\xff\xff", (mpack_expect_array_match(&reader, 0xffff), true));
    TEST_SIMPLE_READ_CANCEL("\xdd\xff\xff\xff\xff", (mpack_expect_array_match(&reader, UINT32_MAX), true));
    TEST_SIMPLE_READ_ERROR("\x91", (mpack_expect_array_match(&reader, 2), true), mpack_error_type);

    TEST_SIMPLE_READ_CANCEL("\x91", true == mpack_expect_array_or_nil(&reader, &count));
    TEST_TRUE(count == 1);
    TEST_SIMPLE_READ_CANCEL("\xc0", false == mpack_expect_array_or_nil(&reader, &count));
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x81", false == mpack_expect_array_or_nil(&reader, &count), mpack_error_type);
    TEST_TRUE(count == 0);

    TEST_SIMPLE_READ_CANCEL("\x91", true == mpack_expect_array_max_or_nil(&reader, 1, &count));
    TEST_TRUE(count == 1);
    TEST_SIMPLE_READ_CANCEL("\xc0", false == mpack_expect_array_max_or_nil(&reader, 0, &count));
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x92", false == mpack_expect_array_max_or_nil(&reader, 1, &count), mpack_error_type);
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x81", false == mpack_expect_array_max_or_nil(&reader, 1, &count), mpack_error_type);
    TEST_TRUE(count == 0);

    // array allocs

    #ifdef MPACK_MALLOC
    int* elements;

    TEST_SIMPLE_READ("\x90", (elements = mpack_expect_array_alloc(&reader, int, 1, &count), mpack_done_array(&reader), true));
    TEST_TRUE(elements == NULL);
    TEST_SIMPLE_READ_CANCEL("\x91", NULL != (elements = mpack_expect_array_alloc(&reader, int, 1, &count)));
    if (elements) {
        elements[0] = 0;
        MPACK_FREE(elements);
    }
    TEST_SIMPLE_READ_CANCEL("\x92", NULL != (elements = mpack_expect_array_alloc(&reader, int, 2, &count)));
    if (elements) {
        elements[0] = 0;
        elements[1] = 1;
        MPACK_FREE(elements);
    }

    TEST_SIMPLE_READ_ERROR("\x92", (elements = mpack_expect_array_alloc(&reader, int, 1, &count), true), mpack_error_type);
    TEST_TRUE(elements == NULL);
    TEST_SIMPLE_READ_ERROR("\xc0", (elements = mpack_expect_array_alloc(&reader, int, 1, &count), true), mpack_error_type);
    TEST_TRUE(elements == NULL);

    TEST_SIMPLE_READ("\x90", (elements = mpack_expect_array_or_nil_alloc(&reader, int, 1, &count), true));
    TEST_TRUE(elements == NULL);
    TEST_SIMPLE_READ_CANCEL("\x91", NULL != (elements = mpack_expect_array_or_nil_alloc(&reader, int, 1, &count)));
    if (elements) {
        elements[0] = 0;
        MPACK_FREE(elements);
    }
    TEST_SIMPLE_READ_CANCEL("\x92", NULL != (elements = mpack_expect_array_or_nil_alloc(&reader, int, 2, &count)));
    if (elements) {
        elements[0] = 0;
        elements[1] = 1;
        MPACK_FREE(elements);
    }

    TEST_SIMPLE_READ_ERROR("\x92", (elements = mpack_expect_array_or_nil_alloc(&reader, int, 1, &count), true), mpack_error_type);
    TEST_TRUE(elements == NULL);
    TEST_SIMPLE_READ("\xc0", (elements = mpack_expect_array_or_nil_alloc(&reader, int, 1, &count), true));
    TEST_TRUE(elements == NULL);
    #endif

}

static void test_expect_maps() {
    uint32_t count;

    // maps

    TEST_SIMPLE_READ_CANCEL("\x80", 0 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\x81", 1 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\x8f", 15 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xde\x00\x00", 0 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xde\x01\x00", 0x100 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xde\xff\xff", 0xffff == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdf\x00\x00\x00\x00", 0 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdf\x00\x00\x01\x00", 0x100 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdf\x00\x01\x00\x00", 0x10000 == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_CANCEL("\xdf\xff\xff\xff\xff", UINT32_MAX == mpack_expect_map(&reader));
    TEST_SIMPLE_READ_ERROR("\x00", 0 == mpack_expect_map(&reader), mpack_error_type);

    // map ranges

    TEST_SIMPLE_READ_CANCEL("\x81", 1 == mpack_expect_map_range(&reader, 0, 1));
    TEST_SIMPLE_READ_CANCEL("\x81", 1 == mpack_expect_map_range(&reader, 1, 1));
    TEST_SIMPLE_READ_ERROR("\x81", 2 == mpack_expect_map_range(&reader, 2, 2), mpack_error_type);
    TEST_SIMPLE_READ_ASSERT("\x81", mpack_expect_map_range(reader, 2, 1));
    TEST_SIMPLE_READ_CANCEL("\x81", 1 == mpack_expect_map_max(&reader, 1));
    TEST_SIMPLE_READ_ERROR("\x81", 0 == mpack_expect_map_max(&reader, 0), mpack_error_type);

    TEST_SIMPLE_READ("\x80", (mpack_expect_map_match(&reader, 0), mpack_done_map(&reader), true));
    TEST_SIMPLE_READ_CANCEL("\x8f", (mpack_expect_map_match(&reader, 15), true));
    TEST_SIMPLE_READ_CANCEL("\xde\xff\xff", (mpack_expect_map_match(&reader, 0xffff), true));
    TEST_SIMPLE_READ_CANCEL("\xdf\xff\xff\xff\xff", (mpack_expect_map_match(&reader, UINT32_MAX), true));
    TEST_SIMPLE_READ_ERROR("\x81", (mpack_expect_map_match(&reader, 2), true), mpack_error_type);

    TEST_SIMPLE_READ_CANCEL("\x81", true == mpack_expect_map_or_nil(&reader, &count));
    TEST_TRUE(count == 1);
    TEST_SIMPLE_READ_CANCEL("\xc0", false == mpack_expect_map_or_nil(&reader, &count));
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x91", false == mpack_expect_map_or_nil(&reader, &count), mpack_error_type);
    TEST_TRUE(count == 0);

    TEST_SIMPLE_READ_CANCEL("\x81", true == mpack_expect_map_max_or_nil(&reader, 1, &count));
    TEST_TRUE(count == 1);
    TEST_SIMPLE_READ_CANCEL("\xc0", false == mpack_expect_map_max_or_nil(&reader, 0, &count));
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x82", false == mpack_expect_map_max_or_nil(&reader, 1, &count), mpack_error_type);
    TEST_TRUE(count == 0);
    TEST_SIMPLE_READ_ERROR("\x91", false == mpack_expect_map_max_or_nil(&reader, 1, &count), mpack_error_type);
    TEST_TRUE(count == 0);

}

static void test_expect_key_cstr_basic() {
    mpack_reader_t reader;
    mpack_reader_init_data(&reader, test_example, TEST_EXAMPLE_SIZE);

    static const char* keys[] = {"schema","compact"};
    #define KEY_COUNT (sizeof(keys) / sizeof(keys[0]))
    bool found[KEY_COUNT];
    memset(found, 0, sizeof(found));

    TEST_TRUE(2 == mpack_expect_map(&reader));
    TEST_TRUE(1 == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT));
    TEST_TRUE(true == mpack_expect_bool(&reader));
    TEST_TRUE(0 == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT));
    TEST_TRUE(0 == mpack_expect_u8(&reader));
    mpack_done_map(&reader);

    TEST_READER_DESTROY_NOERROR(&reader);
    TEST_TRUE(found[0]);
    TEST_TRUE(found[1]);
    #undef KEY_COUNT
}

static void test_expect_key_cstr_mixed() {
    mpack_reader_t reader;
    mpack_reader_init_data(&reader, test_example, TEST_EXAMPLE_SIZE);

    static const char* keys[] = { "unknown", "schema", "unknown2" };
    #define KEY_COUNT (sizeof(keys) / sizeof(keys[0]))
    bool found[KEY_COUNT];
    memset(found, 0, sizeof(found));

    TEST_TRUE(2 == mpack_expect_map(&reader));
    TEST_TRUE(KEY_COUNT == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT)); // unknown
    mpack_discard(&reader);
    TEST_TRUE(1 == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT));
    TEST_TRUE(0 == mpack_expect_u8(&reader));
    mpack_done_map(&reader);

    TEST_READER_DESTROY_NOERROR(&reader);
    TEST_TRUE(!found[0]);
    TEST_TRUE(found[1]);
    TEST_TRUE(!found[2]);
    #undef KEY_COUNT
}

static void test_expect_key_cstr_duplicate() {
    static const char data[] = "\x83\xA3""dup\xC0\xA3""dup\xC0\xA5""valid\xC0";
    mpack_reader_t reader;
    mpack_reader_init_data(&reader, data, sizeof(data)-1);

    static const char* keys[] = { "valid", "dup" };
    #define KEY_COUNT (sizeof(keys) / sizeof(keys[0]))
    bool found[KEY_COUNT];
    memset(found, 0, sizeof(found));

    TEST_TRUE(3 == mpack_expect_map(&reader));
    TEST_TRUE(1 == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT));
    mpack_expect_nil(&reader);
    TEST_TRUE(KEY_COUNT == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT)); // duplicate
    mpack_discard(&reader); // should be no-op due to error
    TEST_TRUE(KEY_COUNT == mpack_expect_key_cstr(&reader, keys, found, KEY_COUNT)); // already in error, not valid

    TEST_READER_DESTROY_ERROR(&reader, mpack_error_invalid);
    #undef KEY_COUNT
}

static void test_expect_key_uint() {
    static const char data[] = "\x85\x02\xC0\x00\xC0\xC3\xC0\x03\xC0\x03\xC0";
    mpack_reader_t reader;
    mpack_reader_init_data(&reader, data, sizeof(data)-1);

    #define KEY_COUNT 4
    bool found[KEY_COUNT];
    memset(found, 0, sizeof(found));

    TEST_TRUE(5 == mpack_expect_map(&reader));
    TEST_TRUE(2 == mpack_expect_key_uint(&reader, found, KEY_COUNT));
    mpack_expect_nil(&reader);
    TEST_TRUE(0 == mpack_expect_key_uint(&reader, found, KEY_COUNT));
    mpack_expect_nil(&reader);
    TEST_TRUE(KEY_COUNT == mpack_expect_key_uint(&reader, found, KEY_COUNT)); // key has value "true", unrecognized
    mpack_discard(&reader);
    TEST_TRUE(3 == mpack_expect_key_uint(&reader, found, KEY_COUNT));
    mpack_expect_nil(&reader);

    TEST_TRUE(mpack_reader_error(&reader) == mpack_ok);
    TEST_TRUE(found[0]);
    TEST_TRUE(!found[1]);
    TEST_TRUE(found[2]);
    TEST_TRUE(found[2]);

    TEST_TRUE(KEY_COUNT == mpack_expect_key_uint(&reader, found, KEY_COUNT));
    TEST_READER_DESTROY_ERROR(&reader, mpack_error_invalid);
    #undef KEY_COUNT
}

void test_expect() {
    test_expect_example_read();

    // int/uint
    test_expect_uint_fixnum();
    test_expect_uint_signed_fixnum();
    test_expect_negative_fixnum();
    test_expect_uint();
    test_expect_uint_signed();
    test_expect_int();
    test_expect_uint_bounds();
    test_expect_int_bounds();
    test_expect_ints_dynamic_int();
    test_expect_int_range();
    test_expect_int_match();

    // compound types
    test_expect_str();
    test_expect_bin();
    test_expect_ext();
    test_expect_arrays();
    test_expect_maps();

    // key switches
    test_expect_key_cstr_basic();
    test_expect_key_cstr_mixed();
    test_expect_key_cstr_duplicate();
    test_expect_key_uint();

    // other
    test_expect_misc();
    #if MPACK_READ_TRACKING
    test_expect_tracking();
    #endif
    test_expect_reals();
    test_expect_reals_range();
    test_expect_bad_type();
    test_expect_pre_error();
}

#endif


Counselor and therapist works with individuals, couples and families, specializing in parenting, child or adolescent issues, relationship issues, depression, divorce and life coaching.
Darling divas, princess, ballerina or tea party themed parties include glitter makeovers, hairstyling, dress-up, crafts, music, dance, games, fashion show, cookie decorating, refreshments, party supplies, organized gift opening and a party director.
Children's dance classes combine ballet, jazz, tap, drama, music and yoga.
Ages 3 and up can choose from jazz, hip-hop, turns and leaps combination classes and competition team training.
Summer camps feature dance, games and arts and crafts for ages 3-11. 2013 sessions run June 17-20, June 24-28 and July 29-Aug. 1. School also offers ballet classes and technique classes during the summer.
Competitive and recreational classes in ballet, tumbling, leaps and turns, jazz, tap and hip-hop for ages 3 and up.
In addition to competitive team, studio offers prep teams for the preK through 9th grade. Classes combine recreation and competition.
Private, competitive dance drill team for ages 3 and up. Classes include ballet, hip-hop, drill training, tumbling and jumps.
Green screen technology superimposes party guests heads onto video bodies of professional dancers in music videos of popular songs. More than 100 videos to choose from.
Ballet, tap, jazz, pointe, hip-hop classes and more, for ages 6 and up.
2015 summer session runs June 30-Aug. 11, offering classes in ballet, tap, tumbling, lyrical, jazz, hip-hop, musical theater and more. Summer intensives are scheduled for June 30-Aug. 12.
Cognitive-behavioral therapy for individuals and families.
Photography services for weddings, engagements, families, parties, special events, campaigns, marketing, on-line advertising and more.
Clinical psychologist specializes in treating eating disorders, body image disturbances, compulsive exercise, obesity, mood and anxiety disorders, stress management, and other adjustment and life issues.
Private riding instruction available in English or Spanish. All ages welcome. By appointment only; call for address and directions.
Copyright © 2019 The Woodlands KidStuff.


The Kavanaugh Senate hearings have little in common with criminal trials, save in that in many trials for sexual offences the jury must choose between irreconcilable stand-alone accounts. The allegation may concern events that happened decades ago; memories are imperfect and there is no supporting evidence on either side. Each side's account seems plausible.


Here is a cool highlight video from our friend, Bamadog, on on Youtube. Some folks say that the win at Ole Miss was a "ho-hum" win, but when you look back at it, there was actaully some nice highlight reel plays in this game. Lets get excited about this Crimson Tide team... a win is a win is a win... especially in the SEC.
My favorite highlight was the Trent Richardson 85 yard catch and run for a TD that comes about 2:45 into the video. Now that was sweeeeeeeeeeeeeet! I am hoping Bama obliterates Tennessee this year. We could use a few highlight reel runs by Trent, Maze (and Julio if healthy), and Ingram in this upcoming Tennessee game. The offense has been struggling a bit, but look for Alabama's offense to break out this week!
Meanwhile, sit back and enjoy this "Nightrain" video (Gun's & Roses) that perfectly illustrates the highlights of Alabama beating Mississippi 23-10 for a spectacular homecoming game at the Capstone!
I am going to add a list of Alabama football tickets for sale below. Check it out too if you are interested in catching an Alabama game in person this year!
This was enjoyable to watch! It makes me anxious to see Mark Barron put Cam Newton in his rightful place!


A new anti-tamper technology with aims similar to those of Denuvo has been rapidly defeated. Valeroa has been touting itself as the latest anti-tamper technology "that cannot be cracked in a reasonable time." However, after appearing for the first time on the game City Patrol: Police, a cracker says he defeated the system in just 20 mins.
With online piracy still running rampant, content producers are keen to prevent copying wherever they can.
Music and movies are extremely vulnerable, with no effective technology available after several decades of trying. However, software and video games are able to put up a bit more of a fight when appropriate DRM and other technologies are put in place.
Situated on top of regular DRM, Denuvo has made its way to the top of the pile as one of the most effective and hated (by pirates at least) anti-tamper technologies. This reputation has in part been earned through its ability to prevent low-level crackers from defeating its locks but also due to a perception that it can be anti-consumer.
With this reputation, Denuvo is consistently targeted by crackers, who are getting more and more successful in defeating the technology. A few days' protection now seems to be the most the product can offer, with the company itself now openly suggesting that a couple of weeks' protection is a reasonable aim and valuable in itself.
Given Denuvo's profile, it was interesting to see an apparently new technology being touted by its makers a few months ago. Dubbed 'Valeroa', this new kid on the anti-tamper block seems to have Denuvo in its sights, with interesting marketing which presents the tech as a more consumer-friendly tool to achieve the same aims.
"Valeroa anti-tamper does [not] require you to have an internet connection. Not even when you launch your game for the first time or after you upgraded your hardware. Some games require you to be online, but this is not a Valeroa requirement," the company claims.
On Saturday December 1, two days after launch, the game appeared online with its protection cracked. A user known online as 'Steam006' (who claims to be from Turkey) was reportedly responsible and if his report is to be believed, Valeroa didn't put up much of a fight.
However, an early version of the website claimed the company was situated in France, offering the address 54-56 Avenue Hoche, Paris 75008.
Adding to the unconventional approach, the site's promotional material actually carries comments from users of Reddit's /r/crackwatch forum which stop short of commending the technology but cautiously praise it for being less anti-consumer than some alternatives.
Valeroa cites Crackwatch user? Whatever next..
While Valeroa fell quickly on this first occasion, it did manage to hold up as long as some of the latest variations of Denuvo, which is an achievement in itself, if one discounts the low interest in the game itself.
"[T]he individual / group behind 'Steam006' released a pirated version of the title in question 2.5 days after its release. Technically Steam006 did not crack the anti-tamper solution in 20 minutes as it was used on emulation tool he worked on for years. This tool does not attack that is protected by the anti-tamper," the statement reads.


text:
Singapore (ENG)
Benefits of CFD trading
CFD trading examples
Benefits of forex trading
Forex trading examples
Using leverage in forex trading
Forex technical indicators
The Artful Trader Podcast
Cryptocurrency trading examples
What is a blockchain fork ?
What are the risks ?
Do you offer a demo account?
CFD login
Australia (English) Australia (简体中文) Österreich Canada (English) Canada (简体中文) France Deutschland Ireland Italia New Zealand (English) New Zealand (简体中文) Norge Polska Singapore (English) Singapore (简体中文) España Sverige United Kingdom International (English) International (简体中文)
IAG job loss announcements rock the travel sector
Even without the sudden shutdown of the travel industry in the last month, the last two years have been a struggle for airlines and the wider sector, with multiple businesses failing, including Monarch, Thomas Cook, and more recently FlyBe.
Apart from problems with overcapacity, the industry has had to contend with two high profile crashes of the Boeing 737 MAX, which caused that plane to be grounded indefinitely and increased the costs of a number of the airlines who used the plane, and had to lease replacement aircraft to fill the gap
Having grounded planes and furloughed staff in the face of the Covid-19 tsunami coming their way the industry is now set for another change and challenge.
Even before last night's announcement from British Airways owner IAG, the challenge for the industry as we look ahead to a post-Covid-19 world, is how recent events would affect thousands of jobs, as consumers hold back and change their behaviour in the wake of this crisis. This appears to be something that IAG has decided to get in front of after the company announced that its British Airways division could see up to 12,000 jobs disappear in the months ahead.
Yesterday evening the company announced a record quarterly loss of €535m, after revenues dropped 13% to €4.6bn, with most of that impact coming from its long-haul business. The company also took a €1.3bn charge on fuel hedges, and with passenger numbers falling 94% in April and May the drop in revenues is expected to be something that is likely to continue for some time to come.
Business travel, which a lot of national carriers rely on, is also likely to see a big drop off as companies realise that lots of meetings can take place just as easily on Zoom and other remote conferencing facilities, a trend that could also have significant consequences for the hotel sector.
While European and US airlines appear to be going down the state-funded bailouts route, this merely delays some tough decisions and that's before you even consider travel companies like TUI Travel, and those businesses that sell package holidays.
US airlines like American Airlines, United Continental, and Delta have all been in receipt of a state-funded bailout by the US taxpayer to the tune of $25bn, while European airlines appear to be following suit with France and the Netherlands set to pledge up to €11bn for Air France KLM, while German rival Deutsche Lufthansa is in discussions with the German government over a multibillion-euro bailout of its own to the tune of €10bn of loans and credit guarantees.
While one could accuse IAG of some cynicism in the timing of its announcement, and it has been one of the few airlines not to go down the bailout route, there appears no escaping the reality that the aviation and travel sector is likely to take several years to return to any sense of normality. It is highly unlikely that normal service could be resumed at a time when social distancing is likely to be with us for some time in the absence of a vaccine. It is also highly unlikely that airlines are going to require the same number of aircraft or staff to run their fleets. More immediately, airlines are likely to face an enormous challenge getting people back on board their aircraft until consumer confidence has returned.
Easyjet CEO Johan Lundgren was rightly ridiculed by Ryanair CEO Michael O'Leary for suggesting that the middle seat could be left vacant as part of a return to normal, given that passengers would still be breathing the same recycled air in the cabin, and that the distance between the window seat and aisle seat is less than a metre. That's even before you consider the distance between the person in the rows in front and behind you, which is probably smaller, than the gap between the window and aisle seats.
Governments can throw as much cash as they like at their national carriers, however it also needs to be done in the knowledge, that some of these loans may well never be repaid, and that job losses are likely to happen anyway to ensure that the airline remains viable, unless governments intend to renationalise then completely.
One thing seems certain, while last night's actions by IAG have attracted some significant criticism in terms of their timing, they also point to the challenges facing the travel sector. Will demand have picked up again, and if not, will airlines have to reconfigure cabins so that passengers aren't crammed in on top of each other? Will air fares become more expensive, as a result of lower capacity, and will package holidays be less popular as a result?
In essence, while governments have gone some way to keeping airlines afloat in the short term, the actions of IAG yesterday have signposted a direction of travel for an industry that is likely to be quite a bit smaller by year end, than it is now.
Latest from CMC
UK-EU trade deal uncertainty no barrier to further FTSE gains
The FTSE 100 had another strong day yesterday, outperforming its European counterparts as optimism over vaccine approval and a Brexit deal gave UK assets a lift.
Airbnb IPO finally set to take flight
Markets muted as US jobs report in focus
USD continues to wobble ahead of NFP
The travel app will make its market debut on 9 December. What will the initial Airbnb share price be? Read our Airbnb IPO preview
It was a mixed bag for European equity markets yesterday as the FTSE 100 closed modestly higher while the indices in mainland Europe posted losses.
CMC Singapore
#30-02 Republic Plaza
Tower I
CMC Markets Singapore Pte. Ltd. (Reg. No./UEN 200605050E.) is regulated by the Monetary Authority of Singapore and holds a capital markets services licence for dealing in capital market products that are over-the-counter derivatives and leveraged foreign exchange, and is an exempt financial adviser.
Contracts for difference (CFD) are leveraged products and carry a high level of risk to your capital as prices may move rapidly against you. It is possible to lose more than your initial investment and you may be required to make further payments. Countdowns carry a level of risk to your capital as you could lose all of your investment. Invest only what you can afford to lose. CFDs and Countdowns involve the risk of substantial loss and trading such products may not be suitable for all clients therefore ensure you understand the risks and seek independent advice. Please read our disclaimers, risk warning/disclosures, terms of business and associated documentation here
This website uses cookies to obtain information about your general internet usage. Removal of cookies may affect the operation of certain parts of this website. For more information about cookies and how to remove them, please read our cookie policy.
Tax treatment depends on the individual circumstances of each client. Tax law can change or may differ depending on the jurisdiction in which you are resident.
Apple, iPad, and iPhone are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc. © 2012 Samsung Telecommunications America, LLC. Samsung and Galaxy S are both registered trademarks of Samsung Electronics Co., Ltd. Android is a trademark of Google Inc. Android is a trademark of Google Inc. Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

redpajama_set_name: RedPajamaCommonCrawl


The birth of a baby is the greatest joy parents can have. Baby brings happiness and a sense of completeness in your family. Most parents, especially first timed parents, would want to announce the world about their baby. Creative baby announcements are important if you want to brag around and make a great first impression to your friends and relatives.
It is a cute library card with personal details of the baby typed on it. Don't forget to stick a nice snapshot of the new born baby underneath!
Take a full body shot of your baby and do a little magic by adding your personal comments on your baby's body features. You can consult a professional designer to do the magic trick.
Feeling that a card will be too mainstreamed? Make a video instead! Short videos of your baby with cute background music will be a simple way to do creative baby announcements.


Recent rumors indicated Microsoft was planning to acquire the hot social collaboration platform Slack. However, it ultimately decided against the acquisition; instead choosing to make its existing portfolio of groupware more robust. The latest example is Office 365 Connectors which provides integration with popular services such as Trello, Twitter, Bing, Wunderlist, GitHub, Salesforce, Visual Studio Team Services, and more.
Office 365 Connectors third-party integration and Outlook Groups are even more powerful. If you prefer spending time in Outlook as your preferred command center; you won't have to worry about missing out on notifications from other popular services you might be using. You can also add and configure Office Connectors using Outlook on the Web.
These new integrations are meant to entice users to consider Outlook when planning to deploy a quick and easy groupware solution. Being partly free, easy to setup and join is part of what makes services such as Slack attractive; Office 365 remains a paid service. Also, the approach to how collaboration is done these days is less about email and more about instant communication. Outlook Groups is still centered around the good old email standard, which is still the lifeline of many enterprises.
Office Connectors is off to a strong start with over 50 connectors available already. Microsoft says Office Connector will be available to Office 365 First Release customers while a general rollout will be available soon. Office 365 Connectors requires an Office 365 business account. Support for Windows 10 Mobile, Android and iOS is also coming soon.
When will this be for the Ordinary Joe /Jane who doesn't use Enterprise or can't afford it?
I don't think the company see's this a solution for the consumer audience. There are some new features in the new Outlook.com such as @replies that work similar to Slack. You will be able to get use that when the transition is complete.


text:
Stephan Schesch (* 1967 in München) ist ein deutscher Filmproduzent.

Leben
Nach einem Stipendium an der französischen "Academie Carat" arbeitete Schesch zunächst als Referent in der Unterhaltungsredaktion von RTL und der Programmdirektion von SAT.1. Durch ein Praktikum bei der Animationsproduktionsfirma Film Roman in Los Angeles spezialisierte er sich auf den Bereich diesen Bereich. Als Chefentwickler der "Trickompany" zeichnete er verantwortlich für die TV Zeichentrickserie Max & Moritz, die mit dem Erich Kästner-Preis ausgezeichnet wurde, sowie für die Zeichentrickserie Nick & Perry. Als Koproduzent wirkte er an den Kinoerfolgen Werner – Volles Rooäää!!! und Kleines Arschloch mit.

Als Berater war Stephan Schesch unter anderem für Columbia TriStar, Saban, Bavaria Film und Hahn Film tätig. Als Geschäftsführer arbeitet er für Ellipse Deutschland und Odeon Animation.

1999 gründete er die Schesch Filmproduktion und produzierte unter anderem Das Gespenst von Canterville (ausgezeichnet mit dem bayerischen Fernsehpreis 2005) und Die Höhle des gelben Hundes von Byambasuren Davaa, (ausgezeichnet mit dem deutschen Filmpreis 2006).

Von 2004 bis 2007 war Schesch Produzent und Geschäftsführer der Animation X, wo er den Zeichentrickfilm Die drei Räuber von Hayo Freitag (ausgezeichnet mit dem Publikumspreis auf dem Festival d'Animation Annecy 2008) produzierte. Zum Jahreswechsel 2008 übernahm Schesch als Alleingesellschafter die Animation X und verschmolz sie mit seiner eigenen Firma zur Schesch Filmkreation GmbH & Co KG.

Als Autor, Produzent und Regisseur realisierte er den Kinozeichentrickfilm Der Mondmann nach dem Bilderbuch von Tomi Ungerer. Der Film feierte seine Welturaufführung auf dem Animations Festival in Annecy/Frankreich und seine Deutschlandpremiere auf dem Filmfest München 2012. Am Jahresende 2013 wurde Der Mondmann auf dem Ale Kino+-Kinderfilmfestival in Poznań, Polen, von einer Lehrerjury mit dem "Teacher's Award for best full-length film for children" ausgezeichnet.

Schesch ist Mitglied der deutschen Filmakademie.

Filmografie
 1987: La Matina, Video, 15-minütiger Kurzfilm
 1989: Pick Up, 10-minütiger Kurzfilm
 1991: Quintessence, TV Game Show Pilot – 4 × 26 Min.
 1996: Werner – Das muss kesseln!!!, Kinozeichentrickfilm
 1997: Kleines Arschloch, Kinozeichentrickfilm
 1997: Max & Moritz, Zeichentrickserie, 39 × 7 Min.
 1997: Nick & Perry – Die Alien Hunde, Zeichentrickserie, 52 × 12 Min.
 1998: Piratenfamilie I, Zeichentrickserie, 26 × 26 Min.
 1999: Who Saw The Man Who Crossed The Planet, 15-minütiger Kurzfilm
 1999: Das Gespenst von Canterville
 1999: Hood
 2000: Der kleine König Macius
 2001: Frog
 2001: Piratenfamilie II
 2005: Die Höhle des Gelben Hundes
 2007: Die drei Räuber
 2012: Der Mondmann

Weblinks

Filmproduzent
Deutscher
Geboren 1967
Mann

redpajama_set_name: RedPajamaWikipedia


text:
Penguins make donations to help shooting victims
Some complained that the confrontational, nationalistic rhetoric of U.S. President Donald Trump has encouraged right-wing extremists and fed a surge in activity by hate groups. Bowers, who underwent surgery and remained hospitalized, is scheduled t... More..
by | Published more than a month ago
by | Tuesday, October 30, 2018
Indian couple killed in fall from California's Yosemite park overlook
Tourists often walk to the cliff's edge where there are no railings to take in the breathtaking views of the valley, Yosemite Falls and El Capitan, and rock fissures that plunge to the valley floor. CHASING SUN...More..
Notorious mob boss Whitey Bulger found dead in prison
The mobster was one of America's most wanted criminals until he was captured in Santa Monica, Calif.in 2011. Bulger had been moved from a Florida prison, and made a stop at an Oklahoma transfer facility earli...More..
Man Charged with Stealing from Closs Home in Barron County
Jaenke-Annis triggered motion cameras installed by authorities when he entered the Closs house just after 2 a.m. Saturday morning. The complaint alleges during an interview with Federal Bureau of Investigatio...More..
Bodies of two sisters found taped together on New York river bank
Police say the victims' feet and waists were duct taped together and they were facing each other. They were officially identified on Friday. Tala Farea had been missing from Fairfax since August 24, according...More..
Sanders: Media wrongly blaming Trump for attacks
The White House on Monday insisted the President had demonstrated the required compassion during trying times. Sanders interrupted him. "Jim, I've given you three questions", she said bluntly. So if fake news m...More..
Children under 15 at serious risk from polluted air
About 1.8 billion children worldwide-that would be 93%-breathe air so toxic that it puts their health, their physical development, and their intelligence at risk, reports the Guardian . Globally, 93% of childr...More..
#OMG Twitter May Be Removing Its Like Button
Nonetheless, users took to Twitter to voice their opinions, and they were not happy about it . Which is one reason it's unusual to learn that, according to a report that's been zipping around Twitter toda...More..
Trump vows to stop USA birthright citizenship
Anton said that Trump could, via executive order, "specify to federal agencies that the children of noncitizens are not citizens" simply because they were born on USA soil. It is disputed whether Mr Trump ...More..
VENICE UNDER WATER: 70% of city covered by flooding
Pictures of committed runners wading through the flooded town have surfaced on social media as onlookers watched the race turn into a swimming event. Transport officials closed the water bus system except to ou...More..
Man found decades after alleged abduction as baby
Meanwhile, Ms. Mann-Lewis was able to fly to the USA for a reunion with her son. While tearfully recounting the reunion, which gave her the chance to cuddle and cook for her son for the first time in decades,...More..
Quake rattles New Zealand as Harry and Meghan visit
The Duke and Duchess of Sussex started their day in Redvale, on Auckland's North Shore, where they dedicated a 20-hectare area of native bush to the Queen's Commonwealth Canopy, which conserves indigenous f...More..
PM Modi tells Indian community in Japan
Giving stress on sports in nation building he said, "spirit, strength, skill and stamina are critical elements for sports as well as nation building". Modi conveyed his wishes to the Indian Hockey Team for this...More..
USA nuclear envoy to arrive in S
And so I am absolutely confident that this is within reach. After Biegun met with South Korea's foreign minister Kang Kyung-wha in the morning and sat down for an hour with his own counterpart, he met with ...More..
EU lists air pollution hotspots as UN warns on child health
Air pollution is slowly easing in EU countries but still causes almost half a million early deaths each year, the European Environment Agency (EEA) said in its annual report published Monday, reports ...More..
Pittsburgh shooting: White House denies Trump rhetoric to blame
Asked about the letter, Sanders maintained that Trump "has denounced racism, hatred and bigotry in all forms, on a number of occasions". "We should be working to eliminate irrational behavior and the empowermen...More..
China's private rocket fails to reach orbit
Zhuque-1, a privately developed Chinese carrier rocket by Beijing-based Landspace, lifts off from the launch pad at Jiuquan Satellite Launch Center in Gansu province, China October 27, 2018. The Landspace state...More..
Woman blows herself up in central Tunis
Ministry spokesman Sofiene Zaag told AFP that all but one of the casualties were police, after a strong explosion Monday rattled the main Avenue Habib Bourguiba in Tunis . It said the attacker was wearing a ...More..
Hillary Clinton: Yes, I Might Run For President Again In 2020
Speaking at a Q&A event in New York City on Friday, Hillary Clinton she would like to be commander in chief even while she wasn't considering running in 2020. "I'm not going to handicap the race before anyone...More..
by | Monday, October 29, 2018
Nightclub shooting in Southern California wounds 7
At least seven people were injured from gunshot wounds during a shooting at a Riverside, California nightclub. "I turned around and people (were) shooting", another partygoer told KTLA , adding that fights s...More..
IS kills 68 US-backed fighters in eastern Syria
A "sandstorm allowed an ISIS counterattack, which was surprising given the conditions, but now the air is clear, the coalition will continue to increase air and fire support to assist our partners", spokesman...More..
The candidates looking to succeed Merkel as CDU leader
Government figures Friedrich Merz , Annegret Kramp-Karrenbauer, Jens Spahn and Armin Laschet could be the next CDU party leaders. A new CDU chair will be elected at the upcoming party conference in Decembe...More..
Pittsburgh synagogue gunman suspect: Who is Robert Bowers?
ASSOCIATED PRESS A police officer walks past the Tree of Life Synagogue and a memorial of flowers and stars in Pittsburgh on Sunday, Oct. 28, 2018, in remembrance of those killed . "There were three shots, a...More..
Saudi Arabia rejects Turkey's extradition request in Khashoggi killing
Saudi Arabia's chief prosecutor has arrived in Istanbul to discuss the killing of Jamal Khashoggi amid a disagreement over where the suspects should stand trial. "Certainly Turkey with the evidence that ...More..
Man, 45, 'who tried to steal the Magna Carta' released on bail
The 45-year-old man was wrestled to the ground by staff at the cathedral after attempting to smash the glass case that housed the ancient manuscript with a hammer on Thursday. "A man matching the description gi...More..
Mourning Across the Country for Pittsburgh Synagogue Victims
The official wasn't authorized to discuss an ongoing investigation and spoke Sunday to The Associated Press on condition of anonymity. A deadly shooting at the Tree of Life synagogue in Pittsburgh on Satu...More..
Eight dead in shooting at Pittsburgh synagogue
Police responded to a call that reported an active shooter in Pittsburgh's Squirrel Hill neighbourhood just before 10 a.m. ET on Saturday, Jones said , and confronted the suspect at the entrance to the syn...More..
Suspicious package addressed to CNN intercepted in Atlanta, network says
It's not yet clear whether the package in Atlanta is similar to more than a dozen that were intercepted last week - all of them using the address of Rep. But the president of the network, Jeff Zucker, in a note...More..
Student dies after shooting at North Carolina high school
Investigators have the weapon used. Police say the students were fighting just before the shooting. Charlotte-Mecklenburg Schools Superintendent Clayton Wilcox told WSOC-TV that the student who fired the gu...More..
Pipe Bomb Suspect Set for First Court Appearance in Florida
On both the packages and the social media posts, her name was spelled "Shultz", according to the complaint. NPR's Greg Myre reports Sayoc lived in his van, which was covered in pro-Trump stickers and anti-lib...More..
Forward »


DHBW Stuttgart cooperates with numerous companies, social institutions and renowned universities all over the world.
The International Office of DHBW Stuttgart coordinates the international activities of DHBW Stuttgart in conjunction with the departments. The International Office provides information and support to students who wish to complete a theoretical semester or a practical phase abroad. The International Office is also the point of contact for partner companies, foreign partners and international visiting students.
A large number of students at DHBW Stuttgart spend a theoretical or practical phase abroad during their degree course. Exchange and ERASMUS programmes are available to students with a variety of universities worldwide. And short programmes, like study tours and summer schools, are also organised by the International Office and the departments. A large number of corporate partners also enable their students to gain an insight into the work of their foreign partner companies.