| 716 | } |
| 717 | |
| 718 | int main(int argc, char **argv) { |
| 719 | while (true) { |
| 720 | static struct option long_options[] = { |
| 721 | /* These options set a flag. */ |
| 722 | {"timing", no_argument, &timing_flag, 1}, |
| 723 | {"no-timing", no_argument, &timing_flag, 0}, |
| 724 | {0, 0, 0, 0} |
| 725 | }; |
| 726 | int opt_result = getopt_long(argc, argv, "", long_options, NULL); |
| 727 | if (-1 == opt_result) break; |
| 728 | if (0 == opt_result) continue; |
| 729 | exit(EXIT_FAILURE); |
| 730 | } |
| 731 | if (simplicity_sha256_compression_is_optimized()) { |
| 732 | printf("Sha optimization enabled.\n"); |
| 733 | if (timing_flag) { |
| 734 | printf("Timings are checked.\n"); |
| 735 | } else { |
| 736 | printf("Timings not checked.\n"); |
| 737 | } |
| 738 | } else { |
| 739 | printf("Sha optimization disabled.\n"); |
| 740 | if (timing_flag) { |
| 741 | printf("Timings cannot be checked.\n"); |
| 742 | } else { |
| 743 | printf("Timings not checked.\n"); |
| 744 | } |
| 745 | timing_flag = 0; |
| 746 | } |
| 747 | test_decodeUptoMaxInt(); |
| 748 | test_hashBlock(); |
| 749 | test_occursCheck(); |
| 750 | |
| 751 | test_hasDuplicates("hasDuplicates no duplicates testcase", 0, rsort_no_duplicates, 10000); |
| 752 | test_hasDuplicates("hasDuplicates all duplicates testcase", 1, rsort_all_duplicates, 10000); |
| 753 | test_hasDuplicates("hasDuplicates one duplicate testcase", 1, rsort_one_duplicate, 10000); |
| 754 | test_hasDuplicates("hasDuplicates diagonal testcase", 0, rsort_diagonal, 33); |
| 755 | |
| 756 | test_program("ctx8Pruned", ctx8Pruned, sizeof_ctx8Pruned, ctx8Pruned_witness, sizeof_ctx8Pruned_witness, SIMPLICITY_NO_ERROR, ctx8Pruned_cmr, ctx8Pruned_ihr, ctx8Pruned_amr, &ctx8Pruned_cost); |
| 757 | test_program("ctx8Unpruned", ctx8Unpruned, sizeof_ctx8Unpruned, ctx8Unpruned_witness, sizeof_ctx8Unpruned_witness, SIMPLICITY_ERR_ANTIDOS, ctx8Unpruned_cmr, ctx8Unpruned_ihr, ctx8Unpruned_amr, &ctx8Unpruned_cost); |
| 758 | if (0 == memcmp(ctx8Pruned_cmr, ctx8Unpruned_cmr, sizeof(uint32_t[8]))) { |
| 759 | successes++; |
| 760 | } else { |
| 761 | failures++; |
| 762 | printf("Pruned and Unpruned CMRs are not the same.\n"); |
| 763 | } |
| 764 | test_program("schnorr0", schnorr0, sizeof_schnorr0, schnorr0_witness, sizeof_schnorr0_witness, SIMPLICITY_NO_ERROR, schnorr0_cmr, schnorr0_ihr, schnorr0_amr, &schnorr0_cost); |
| 765 | test_program("schnorr6", schnorr6, sizeof_schnorr6, schnorr6_witness, sizeof_schnorr6_witness, SIMPLICITY_ERR_EXEC_JET, schnorr6_cmr, schnorr6_ihr, schnorr6_amr, &schnorr0_cost); |
| 766 | test_program("typeSkipTest", typeSkipTest, sizeof_typeSkipTest, typeSkipTest_witness, sizeof_typeSkipTest_witness, SIMPLICITY_NO_ERROR, NULL, NULL, NULL, NULL); |
| 767 | test_elements(); |
| 768 | exactBudget_test(); |
| 769 | regression_tests(); |
| 770 | iden8mebi_test(); |
| 771 | |
| 772 | printf("Successes: %d\n", successes); |
| 773 | printf("Failures: %d\n", failures); |
| 774 | return (0 == failures) ? EXIT_SUCCESS : EXIT_FAILURE; |
| 775 | } |
nothing calls this directly
no test coverage detected