int run_tests() { int i; int success = 0, total = 0; for (i = 0; i < (sizeof(test_cases) / sizeof(test_cases[0])); i++) { uint8_t buf[512], *rb; struct in6_addr addr; uint8_t dispatch = 0; total ++; scribble(buf, 512); inet_pton6(test_cases[i].addr, &addr); printf("addr: %s\n", test_cases[i].addr); rb = pack_multicast(buf, &addr, &dispatch); print_buffer(buf, rb - buf); if (test_cases[i].result_len != (rb - buf)) continue; if (memcmp(test_cases[i].result, buf, rb - buf) != 0) continue; if (test_cases[i].result_dispatch != dispatch) continue; printf("SUCCESS!\n"); success++; } printf("%s: %i/%i tests succeeded\n", __FILE__, success, total); if (success == total) return 0; return 1; }
LargeAllocation* LargeAllocation::tryCreate(Heap& heap, size_t size, Subspace* subspace) { void* space = subspace->alignedMemoryAllocator()->tryAllocateAlignedMemory(alignment, headerSize() + size); if (!space) return nullptr; if (scribbleFreeCells()) scribble(space, size); return new (NotNull, space) LargeAllocation(heap, size, subspace); }
int main( int argc, char **argv ) { QApplication a( argc, argv ); QTabWidget tab; Scribble scribble(&tab, "scribble"); TabletStats tabStats( &tab, "tablet stats" ); scribble.setMinimumSize( 500, 350 ); tabStats.setMinimumSize( 500, 350 ); tab.addTab(&scribble, "Scribble" ); tab.addTab(&tabStats, "Tablet Stats" ); a.setMainWidget( &tab ); if ( QApplication::desktop()->width() > 550 && QApplication::desktop()->height() > 366 ) tab.show(); else tab.showMaximized(); return a.exec(); }
int main() { int total = 0, successes = 0; /* test 1: */ struct ip_iovec v[10]; uint8_t buf[1500], orig[1500], zeroes[1500]; int i; printf("starting spread write test\n"); scribble(buf, sizeof(buf)); memcpy(orig, buf, sizeof(buf)); memset(zeroes, 0, sizeof(zeroes)); for(i = 0; i < 10; i++) { v[i].iov_len = 10; v[i].iov_base = &buf[i*10]; if (i < 9) v[i].iov_next = &v[i+1]; else v[i].iov_next = NULL; } iov_print(v); for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) { int rv; printf("iov_write: test %i offset: %i length: %i\n", i + 1, test_cases[i].offset, test_cases[i].len); total++; rv = iov_update(v, test_cases[i].offset, test_cases[i].len, zeroes); if (rv = test_cases[i].len && memcmp(buf, orig, test_cases[i].offset) == 0 && memcmp(buf+test_cases[i].offset, zeroes+test_cases[i].offset, test_cases[i].len) == 0 && memcmp(buf+test_cases[i].offset+test_cases[i].len, orig+test_cases[i].offset+test_cases[i].len, 100 - test_cases[i].offset -test_cases[i].len) == 0) { printf("test: success\n"); successes ++; } iov_print(v); memcpy(buf, orig, sizeof(buf)); printf("\n\n"); } printf("%s: %i/%i tests succeeded\n", __FILE__, successes, total); }
void introScreen(){ GLCD.ClearScreen(BLACK); GLCD.DrawBitmap(icon, 32,0); //draw the bitmap at the given x,y position countdown(3); GLCD.ClearScreen(); GLCD.SelectFont(Arial_14); // you can also make your own fonts, see playground for details GLCD.CursorToXY(GLCD.Width/2 - 44, 3); GLCD.print("GLCD version "); GLCD.print(GLCD_VERSION, DEC); GLCD.DrawRoundRect(8,0,GLCD.Width-19,17, 5); // rounded rectangle around text area countdown(3); GLCD.ClearScreen(); scribble(5000); // run for 5 seconds moveBall(6000); // kick ball for 6 seconds GLCD.SelectFont(System5x7, BLACK); showCharacters((char*)"5x7 font:", System5x7); countdown(3); showCharacters((char*)"Arial_14:", Arial_14); countdown(3); textAreaDemo(); scrollingDemo(); }