static void test_qemu_strtosz_units(void)

{

    const char *none = "1";

    const char *b = "1B";

    const char *k = "1K";

    const char *m = "1M";

    const char *g = "1G";

    const char *t = "1T";

    const char *p = "1P";

    const char *e = "1E";

    char *endptr = NULL;

    int64_t res;



    /* default is M */

    res = qemu_strtosz_MiB(none, &endptr);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(endptr == none + 1);



    res = qemu_strtosz(b, &endptr);

    g_assert_cmpint(res, ==, 1);

    g_assert(endptr == b + 2);



    res = qemu_strtosz(k, &endptr);

    g_assert_cmpint(res, ==, K_BYTE);

    g_assert(endptr == k + 2);



    res = qemu_strtosz(m, &endptr);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(endptr == m + 2);



    res = qemu_strtosz(g, &endptr);

    g_assert_cmpint(res, ==, G_BYTE);

    g_assert(endptr == g + 2);



    res = qemu_strtosz(t, &endptr);

    g_assert_cmpint(res, ==, T_BYTE);

    g_assert(endptr == t + 2);



    res = qemu_strtosz(p, &endptr);

    g_assert_cmpint(res, ==, P_BYTE);

    g_assert(endptr == p + 2);



    res = qemu_strtosz(e, &endptr);

    g_assert_cmpint(res, ==, E_BYTE);

    g_assert(endptr == e + 2);

}

static void test_qemu_strtosz_units(void)

{

    const char *none = "1";

    const char *b = "1B";

    const char *k = "1K";

    const char *m = "1M";

    const char *g = "1G";

    const char *t = "1T";

    const char *p = "1P";

    const char *e = "1E";

    char *endptr = NULL;

    int64_t res;



    

    res = qemu_strtosz_MiB(none, &endptr);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(endptr == none + 1);



    res = qemu_strtosz(b, &endptr);

    g_assert_cmpint(res, ==, 1);

    g_assert(endptr == b + 2);



    res = qemu_strtosz(k, &endptr);

    g_assert_cmpint(res, ==, K_BYTE);

    g_assert(endptr == k + 2);



    res = qemu_strtosz(m, &endptr);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(endptr == m + 2);



    res = qemu_strtosz(g, &endptr);

    g_assert_cmpint(res, ==, G_BYTE);

    g_assert(endptr == g + 2);



    res = qemu_strtosz(t, &endptr);

    g_assert_cmpint(res, ==, T_BYTE);

    g_assert(endptr == t + 2);



    res = qemu_strtosz(p, &endptr);

    g_assert_cmpint(res, ==, P_BYTE);

    g_assert(endptr == p + 2);



    res = qemu_strtosz(e, &endptr);

    g_assert_cmpint(res, ==, E_BYTE);

    g_assert(endptr == e + 2);

}

static void FUNC_0(void)

{

    const char *VAR_0 = "1";

    const char *VAR_1 = "1B";

    const char *VAR_2 = "1K";

    const char *VAR_3 = "1M";

    const char *VAR_4 = "1G";

    const char *VAR_5 = "1T";

    const char *VAR_6 = "1P";

    const char *VAR_7 = "1E";

    char *VAR_8 = NULL;

    int64_t res;



    

    res = qemu_strtosz_MiB(VAR_0, &VAR_8);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(VAR_8 == VAR_0 + 1);



    res = qemu_strtosz(VAR_1, &VAR_8);

    g_assert_cmpint(res, ==, 1);

    g_assert(VAR_8 == VAR_1 + 2);



    res = qemu_strtosz(VAR_2, &VAR_8);

    g_assert_cmpint(res, ==, K_BYTE);

    g_assert(VAR_8 == VAR_2 + 2);



    res = qemu_strtosz(VAR_3, &VAR_8);

    g_assert_cmpint(res, ==, M_BYTE);

    g_assert(VAR_8 == VAR_3 + 2);



    res = qemu_strtosz(VAR_4, &VAR_8);

    g_assert_cmpint(res, ==, G_BYTE);

    g_assert(VAR_8 == VAR_4 + 2);



    res = qemu_strtosz(VAR_5, &VAR_8);

    g_assert_cmpint(res, ==, T_BYTE);

    g_assert(VAR_8 == VAR_5 + 2);



    res = qemu_strtosz(VAR_6, &VAR_8);

    g_assert_cmpint(res, ==, P_BYTE);

    g_assert(VAR_8 == VAR_6 + 2);



    res = qemu_strtosz(VAR_7, &VAR_8);

    g_assert_cmpint(res, ==, E_BYTE);

    g_assert(VAR_8 == VAR_7 + 2);

}

static void FUNC_0(void)
{ const char *VAR_0 = "1"; const char *VAR_1 = "1B"; const char *VAR_2 = "1K"; const char *VAR_3 = "1M"; const char *VAR_4 = "1G"; const char *VAR_5 = "1T"; const char *VAR_6 = "1P"; const char *VAR_7 = "1E"; char *VAR_8 = NULL; int64_t res; res = qemu_strtosz_MiB(VAR_0, &VAR_8); g_assert_cmpint(res, ==, M_BYTE); g_assert(VAR_8 == VAR_0 + 1); res = qemu_strtosz(VAR_1, &VAR_8); g_assert_cmpint(res, ==, 1); g_assert(VAR_8 == VAR_1 + 2); res = qemu_strtosz(VAR_2, &VAR_8); g_assert_cmpint(res, ==, K_BYTE); g_assert(VAR_8 == VAR_2 + 2); res = qemu_strtosz(VAR_3, &VAR_8); g_assert_cmpint(res, ==, M_BYTE); g_assert(VAR_8 == VAR_3 + 2); res = qemu_strtosz(VAR_4, &VAR_8); g_assert_cmpint(res, ==, G_BYTE); g_assert(VAR_8 == VAR_4 + 2); res = qemu_strtosz(VAR_5, &VAR_8); g_assert_cmpint(res, ==, T_BYTE); g_assert(VAR_8 == VAR_5 + 2); res = qemu_strtosz(VAR_6, &VAR_8); g_assert_cmpint(res, ==, P_BYTE); g_assert(VAR_8 == VAR_6 + 2); res = qemu_strtosz(VAR_7, &VAR_8); g_assert_cmpint(res, ==, E_BYTE); g_assert(VAR_8 == VAR_7 + 2); }