You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
956 B
39 lines
956 B
8 years ago
|
#include "../src/common.h"
|
||
|
#include "../src/simdb.h"
|
||
|
#include "../src/record.h"
|
||
|
|
||
|
#include <arpa/inet.h> /* htons */
|
||
|
|
||
|
int
|
||
|
main() {
|
||
|
simdb_urec_t r;
|
||
|
|
||
|
memset(&r, 0x0, sizeof(r));
|
||
|
|
||
|
assert(sizeof(r) == SIMDB_REC_LEN);
|
||
|
|
||
|
r.used = 0xFF;
|
||
|
r.clevel_r = 0x52; /* 'R' */
|
||
|
r.clevel_g = 0x47; /* 'G' */
|
||
|
r.clevel_b = 0x42; /* 'B' */
|
||
|
r.image_w = htons(1024);
|
||
|
r.image_h = htons(768);
|
||
|
memset(r.bitmap, 0xA5, sizeof(r.bitmap));
|
||
|
|
||
|
/* note: htons() used here only for portability, *
|
||
|
* in real database it's not used */
|
||
|
|
||
|
unsigned char bytes[SIMDB_REC_LEN] = {
|
||
|
0xFF, 0x52, 0x47, 0x42, 0x04, 0x00, 0x03, 0x00,
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||
|
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5,
|
||
|
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5,
|
||
|
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5,
|
||
|
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5,
|
||
|
};
|
||
|
|
||
|
assert(memcmp(&r, bytes, sizeof(r)) == 0);
|
||
|
|
||
|
return 0;
|
||
|
}
|