void run_test(void) { tty_puts("\nSDRAM test started\n"); #ifdef TEST_RANDOM tty_puts("Random data\n"); while(1) random_longs(DRAM_START, DRAM_END); #endif #ifdef TEST_PARALLEL parallel_longs(DRAM_START, (unsigned long *)DRAM_START, (unsigned long *)(DRAM_START+((DRAM_END-DRAM_START)/2)), (unsigned long *)DRAM_END, inc_addr); parallel_longs(0x00000000, (unsigned long *)DRAM_START, (unsigned long *)(DRAM_START+((DRAM_END-DRAM_START)/2)), (unsigned long *)DRAM_END, nop); #endif #ifdef TEST_LONG tty_puts("*** Testing LONG\n"); test_longs("ZERO: ", 0x00000000, (unsigned long *)DRAM_START, (unsigned long *)DRAM_END, nop, 1, 1); test_longs("ONES: ", 0xFFFFFFFF, (unsigned long *)DRAM_START, (unsigned long *)DRAM_END, nop, 1, 1); test_longs("ALTS: ", 0x55AA55AA, (unsigned long *)DRAM_START, (unsigned long *)DRAM_END, toggle, 1, 1); test_longs("ADDR: ", DRAM_START, (unsigned long *)DRAM_START, (unsigned long *)DRAM_END, inc_addr, 1, 1); #endif #ifdef TEST_SHORTS tty_puts("*** Testing SHORT\n"); test_shorts("ZERO: ", 0x0000, (unsigned short *)DRAM_START, (unsigned short *)DRAM_END, nop, 1, 1); test_shorts("ONES: ", 0xFFFF, (unsigned short *)DRAM_START, (unsigned short *)DRAM_END, nop, 1, 1); test_shorts("ALTS: ", 0x55AA, (unsigned short *)DRAM_START, (unsigned short *)DRAM_END, toggle, 1, 1); test_shorts("ADDR: ", 0, (unsigned short *)DRAM_START, (unsigned short *)DRAM_END, inc_addr, 1, 1); #endif #ifdef TEST_BYTES tty_puts("*** Testing BYTE\n"); test_bytes("ZERO: ", 0x00, (unsigned char *)DRAM_START, (unsigned char *)DRAM_END, nop, 1, 1); test_bytes("ONES: ", 0xFF, (unsigned char *)DRAM_START, (unsigned char *)DRAM_END, nop, 1, 1); test_bytes("ALTS: ", 0xAA, (unsigned char *)DRAM_START, (unsigned char *)DRAM_END, toggle, 1, 1); test_bytes("ADDR: ", 0, (unsigned char *)DRAM_START, (unsigned char *)DRAM_END, inc_addr, 1, 1); #endif #ifdef TEST_REFRESH tty_puts("*** Testing REFRESH\n"); test_longs("LONG: ", DRAM_START, (unsigned long *)DRAM_START, (unsigned long *)DRAM_END, inc_addr, 32, 32); test_shorts("SHORT: ", 0, (unsigned short *)DRAM_START, (unsigned short *)DRAM_END, inc_addr, 32, 32); test_bytes("BYTE: ", 0, (unsigned char *)DRAM_START, (unsigned char *)DRAM_END, inc_addr, 32, 32); #endif // Done tty_puts("Done\n"); }
int main(void) { test_null(); test_num(); test_bytes(); test_appendNum(); test_appendBytes(); test_toByte(); test_toByte_4bitpadding(); test_size(); report(); return 0; }
void test_output() { if (output[0] != BERT_MAGIC) { test_fail("bert_encoder_push did not add the magic byte"); } if (output[1] != BERT_INT) { test_fail("bert_encoder_push did not add the INT magic byte"); } unsigned char bytes[] = {0x00, 0xff, 0xff, 0xff}; test_bytes(output+2,bytes,4); }
int main(int argc, char **argv) { test_null(); test_num(); test_bytes(); test_appendNum(); test_appendBytes(); test_toByte(); test_toByte_4bitpadding(); test_size(); test_append(); report(); return 0; }
TEST(test_encode_decode, test_bytes) { test_bytes("", "00"); test_bytes(krpc::platform::unhexlify("bada55"), "03bada55"); test_bytes(krpc::platform::unhexlify("deadbeef"), "04deadbeef"); }