| 323 | } |
| 324 | |
| 325 | static void test_occursCheck(void) { |
| 326 | printf("Test occursCheck\n"); |
| 327 | /* The untyped Simplicity term (case (drop iden) iden) ought to cause an occurs check failure. */ |
| 328 | const unsigned char buf[] = { 0xc1, 0x07, 0x20, 0x30 }; |
| 329 | dag_node* dag; |
| 330 | combinator_counters census; |
| 331 | int_fast32_t len; |
| 332 | { |
| 333 | bitstream stream = initializeBitstream(buf, sizeof(buf)); |
| 334 | len = simplicity_decodeMallocDag(&dag, simplicity_elements_decodeJet, &census, &stream); |
| 335 | } |
| 336 | if (!dag) { |
| 337 | simplicity_assert(len < 0); |
| 338 | printf("Error parsing dag: %" PRIdFAST32 "\n", len); |
| 339 | } else { |
| 340 | type* type_dag; |
| 341 | simplicity_assert(0 < len); |
| 342 | if (SIMPLICITY_ERR_TYPE_INFERENCE_OCCURS_CHECK == simplicity_mallocTypeInference(&type_dag, simplicity_elements_mallocBoundVars, dag, (uint_fast32_t)len, &census) && |
| 343 | !type_dag) { |
| 344 | successes++; |
| 345 | } else { |
| 346 | printf("Unexpected occurs check success\n"); |
| 347 | failures++; |
| 348 | } |
| 349 | simplicity_free(type_dag); |
| 350 | } |
| 351 | simplicity_free(dag); |
| 352 | } |
| 353 | |
| 354 | static void test_elements(void) { |
| 355 | unsigned char cmr[32], amr[32]; |
no test coverage detected