#include <my_assert.h>



#define RUN_TEST(fname,cb_size_t,ulong_to_cb_size_t,cb_size_t_to_ulong) \
    void fname (void) \
    { \
        ULONG64 u, w; \
        cb_size_t co; \
        for (u = 0; u < ((ULONG) 1L << (sizeof(cb_size_t) * 8)); u = (u + 1) * 17 / 16) { \
            ulong_to_cb_size_t (&co, u); \
            w = cb_size_t_to_ulong (co); \
            assert (u == w); \
        } \
 \
        u = ((ULONG) 1L << (sizeof(cb_size_t) * 8)) - 1; \
        ulong_to_cb_size_t (&co, u); \
        w = cb_size_t_to_ulong (co); \
        assert (u == w); \
 \
        u = ((ULONG) 1L << (sizeof(cb_size_t) * 8)); \
        ulong_to_cb_size_t (&co, u); \
        w = cb_size_t_to_ulong (co); \
        assert (u != w); \
        printf ("passed %d\n", (int) sizeof(cb_size_t)); \
    }



#define SIZEOF_CB_SIZE          2
#define cb_size_s               cb_size_2_s
#define cb_size_t               cb_size_2_t
#define ulong_to_cb_size_t      ulong_to_cb_size_t2
#define cb_size_t_to_ulong      cb_size_t_to_ulong2
struct cb_size_s {
    unsigned char d[SIZEOF_CB_SIZE];
} __attribute__((packed));
typedef struct cb_size_s cb_size_t;
#include "cb_size_t_to_ulong.h"
RUN_TEST(test2, cb_size_2_t, ulong_to_cb_size_t2, cb_size_t_to_ulong2);
#undef cb_size_t_to_ulong
#undef ulong_to_cb_size_t
#undef cb_size_s
#undef cb_size_t
#undef SIZEOF_CB_SIZE


#define SIZEOF_CB_SIZE          3
#define cb_size_s               cb_size_3_s
#define cb_size_t               cb_size_3_t
#define ulong_to_cb_size_t      ulong_to_cb_size_t3
#define cb_size_t_to_ulong      cb_size_t_to_ulong3
struct cb_size_s {
    unsigned char d[SIZEOF_CB_SIZE];
} __attribute__((packed));
typedef struct cb_size_s cb_size_t;
#include "cb_size_t_to_ulong.h"
RUN_TEST(test3, cb_size_3_t, ulong_to_cb_size_t3, cb_size_t_to_ulong3);
#undef cb_size_t_to_ulong
#undef ulong_to_cb_size_t
#undef cb_size_s
#undef cb_size_t
#undef SIZEOF_CB_SIZE



#define SIZEOF_CB_SIZE          4
#define cb_size_s               cb_size_4_s
#define cb_size_t               cb_size_4_t
#define ulong_to_cb_size_t      ulong_to_cb_size_t4
#define cb_size_t_to_ulong      cb_size_t_to_ulong4
struct cb_size_s {
    unsigned char d[SIZEOF_CB_SIZE];
} __attribute__((packed));
typedef struct cb_size_s cb_size_t;
#include "cb_size_t_to_ulong.h"
RUN_TEST(test4, cb_size_4_t, ulong_to_cb_size_t4, cb_size_t_to_ulong4);
#undef cb_size_t_to_ulong
#undef ulong_to_cb_size_t
#undef cb_size_s
#undef cb_size_t
#undef SIZEOF_CB_SIZE



#define SIZEOF_CB_SIZE          5
#define cb_size_s               cb_size_5_s
#define cb_size_t               cb_size_5_t
#define ulong_to_cb_size_t      ulong_to_cb_size_t5
#define cb_size_t_to_ulong      cb_size_t_to_ulong5
struct cb_size_s {
    unsigned char d[SIZEOF_CB_SIZE];
} __attribute__((packed));
typedef struct cb_size_s cb_size_t;
#include "cb_size_t_to_ulong.h"
RUN_TEST(test5, cb_size_5_t, ulong_to_cb_size_t5, cb_size_t_to_ulong5);
#undef cb_size_t_to_ulong
#undef ulong_to_cb_size_t
#undef cb_size_s
#undef cb_size_t
#undef SIZEOF_CB_SIZE




#define SIZEOF_CB_SIZE          6
#define cb_size_s               cb_size_6_s
#define cb_size_t               cb_size_6_t
#define ulong_to_cb_size_t      ulong_to_cb_size_t6
#define cb_size_t_to_ulong      cb_size_t_to_ulong6
struct cb_size_s {
    unsigned char d[SIZEOF_CB_SIZE];
} __attribute__((packed));
typedef struct cb_size_s cb_size_t;
#include "cb_size_t_to_ulong.h"
RUN_TEST(test6, cb_size_6_t, ulong_to_cb_size_t6, cb_size_t_to_ulong6);
#undef cb_size_t_to_ulong
#undef ulong_to_cb_size_t
#undef cb_size_s
#undef cb_size_t
#undef SIZEOF_CB_SIZE





void entry (void)
{
    test2 ();
    test3 ();
    test4 ();
    test5 ();
    test6 ();
}
