MCPcopy Create free account
hub / github.com/ElementsProject/elements / regression_tests

Function regression_tests

src/simplicity/test.c:569–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569static void regression_tests(void) {
570 {
571 /* word("2^23 zero bits") ; unit */
572 size_t sizeof_regression3 = ((size_t)1 << 20) + 4;
573 unsigned char *regression3 = simplicity_calloc(sizeof_regression3, 1);
574 clock_t start, end;
575 double diff, bound;
576 const uint32_t cmr[] = {
577 0x872d12eeu, 0x631ae2e7u, 0xffb8b06au, 0xc54ef77fu, 0x693adbffu, 0xb229e760u, 0x111b8fd9u, 0x13d88b7au
578 };
579 simplicity_assert(regression3);
580 regression3[0] = 0xb7; regression3[1] = 0x08;
581 regression3[sizeof_regression3 - 2] = 0x48; regression3[sizeof_regression3 - 1] = 0x20;
582 start = clock();
583 test_program("regression3", regression3, sizeof_regression3, NULL, 0, SIMPLICITY_ERR_EXEC_MEMORY, cmr, NULL, NULL, NULL);
584 end = clock();
585 diff = (double)(end - start) / CLOCKS_PER_SEC;
586 bound = (double)(sizeof_regression3) * secondsPerWU;
587 printf("cpu_time_used by regression3: %f s. (Should be less than %f s.)\n", diff, bound);
588 if (timing_flag) {
589 if (diff <= bound) {
590 successes++;
591 } else {
592 failures++;
593 printf("regression3 took too long.\n");
594 }
595 }
596 simplicity_free(regression3);
597 }
598 {
599 clock_t start, end;
600 double diff, bound;
601 start = clock();
602 test_program("regression4", regression4, sizeof_regression4, NULL, 0, SIMPLICITY_NO_ERROR, NULL, NULL, NULL, NULL);
603 end = clock();
604 diff = (double)(end - start) / CLOCKS_PER_SEC;
605 bound = (double)(sizeof_regression4) * secondsPerWU;
606 printf("cpu_time_used by regression4: %f s. (Should be less than %f s.)\n", diff, bound);
607 if (timing_flag) {
608 if (diff <= bound) {
609 successes++;
610 } else {
611 failures++;
612 printf("regression4 took too long.\n");
613 }
614 }
615 }
616}
617
618static void iden8mebi_test(void) {
619 /* iden composed with itself 2^23 times. */

Callers 1

mainFunction · 0.85

Calls 2

test_programFunction · 0.85
printfFunction · 0.85

Tested by

no test coverage detected