Lines Matching refs:fixture
24 static void tear_down(CMP_HDR_TEST_FIXTURE *fixture) in tear_down() argument
26 OSSL_CMP_PKIHEADER_free(fixture->hdr); in tear_down()
27 OSSL_CMP_CTX_free(fixture->cmp_ctx); in tear_down()
28 OPENSSL_free(fixture); in tear_down()
33 CMP_HDR_TEST_FIXTURE *fixture; in set_up() local
35 if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture)))) in set_up()
37 fixture->test_case_name = test_case_name; in set_up()
38 if (!TEST_ptr(fixture->cmp_ctx = OSSL_CMP_CTX_new(NULL, NULL))) in set_up()
40 if (!TEST_ptr(fixture->hdr = OSSL_CMP_PKIHEADER_new())) in set_up()
42 return fixture; in set_up()
45 tear_down(fixture); in set_up()
49 static int execute_HDR_set_get_pvno_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set_get_pvno_test() argument
53 if (!TEST_int_eq(ossl_cmp_hdr_set_pvno(fixture->hdr, pvno), 1)) in execute_HDR_set_get_pvno_test()
55 if (!TEST_int_eq(ossl_cmp_hdr_get_pvno(fixture->hdr), pvno)) in execute_HDR_set_get_pvno_test()
63 fixture->expected = 1; in test_HDR_set_get_pvno()
72 static int execute_HDR_get0_senderNonce_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_get0_senderNonce_test() argument
81 if (!TEST_int_eq(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, sender), in execute_HDR_get0_senderNonce_test()
84 if (!TEST_int_eq(ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr), in execute_HDR_get0_senderNonce_test()
87 sn = ossl_cmp_hdr_get0_senderNonce(fixture->hdr); in execute_HDR_get0_senderNonce_test()
88 if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->cmp_ctx->senderNonce, sn), in execute_HDR_get0_senderNonce_test()
98 fixture->expected = 1; in test_HDR_get0_senderNonce()
103 static int execute_HDR_set1_sender_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_sender_test() argument
111 if (!TEST_int_eq(ossl_cmp_hdr_set1_sender(fixture->hdr, x509name), 1)) in execute_HDR_set1_sender_test()
113 if (!TEST_int_eq(fixture->hdr->sender->type, GEN_DIRNAME)) in execute_HDR_set1_sender_test()
116 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->sender->d.directoryName, in execute_HDR_set1_sender_test()
127 fixture->expected = 1; in test_HDR_set1_sender()
132 static int execute_HDR_set1_recipient_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_recipient_test() argument
140 if (!TEST_int_eq(ossl_cmp_hdr_set1_recipient(fixture->hdr, x509name), 1)) in execute_HDR_set1_recipient_test()
143 if (!TEST_int_eq(fixture->hdr->recipient->type, GEN_DIRNAME)) in execute_HDR_set1_recipient_test()
146 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->recipient->d.directoryName, in execute_HDR_set1_recipient_test()
157 fixture->expected = 1; in test_HDR_set1_recipient()
162 static int execute_HDR_update_messageTime_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_update_messageTime_test() argument
176 if (!TEST_true(ossl_cmp_hdr_update_messageTime(fixture->hdr))) in execute_HDR_update_messageTime_test()
178 if (!TEST_true(ASN1_TIME_to_tm(fixture->hdr->messageTime, &hdrtm))) in execute_HDR_update_messageTime_test()
195 fixture->expected = 1; in test_HDR_update_messageTime()
200 static int execute_HDR_set1_senderKID_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_senderKID_test() argument
211 if (!TEST_int_eq(ossl_cmp_hdr_set1_senderKID(fixture->hdr, senderKID), 1)) in execute_HDR_set1_senderKID_test()
213 if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->hdr->senderKID, in execute_HDR_set1_senderKID_test()
225 fixture->expected = 1; in test_HDR_set1_senderKID()
230 static int execute_HDR_push0_freeText_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_push0_freeText_test() argument
240 if (!TEST_int_eq(ossl_cmp_hdr_push0_freeText(fixture->hdr, text), 1)) in execute_HDR_push0_freeText_test()
243 if (!TEST_true(text == sk_ASN1_UTF8STRING_value(fixture->hdr->freeText, 0))) in execute_HDR_push0_freeText_test()
256 fixture->expected = 1; in test_HDR_push0_freeText()
261 static int execute_HDR_push1_freeText_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_push1_freeText_test() argument
273 if (!TEST_int_eq(ossl_cmp_hdr_push1_freeText(fixture->hdr, text), 1)) in execute_HDR_push1_freeText_test()
276 pushed_text = sk_ASN1_UTF8STRING_value(fixture->hdr->freeText, 0); in execute_HDR_push1_freeText_test()
289 fixture->expected = 1; in test_HDR_push1_freeText()
295 execute_HDR_generalInfo_push0_item_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_generalInfo_push0_item_test() argument
302 if (!TEST_int_eq(ossl_cmp_hdr_generalInfo_push0_item(fixture->hdr, itav), in execute_HDR_generalInfo_push0_item_test()
306 if (!TEST_true(itav == sk_OSSL_CMP_ITAV_value(fixture->hdr->generalInfo, in execute_HDR_generalInfo_push0_item_test()
316 fixture->expected = 1; in test_HDR_generalInfo_push0_item()
322 execute_HDR_generalInfo_push1_items_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_generalInfo_push1_items_test() argument
352 if (!TEST_int_eq(ossl_cmp_hdr_generalInfo_push1_items(fixture->hdr, itavs), in execute_HDR_generalInfo_push1_items_test()
355 ginfo = fixture->hdr->generalInfo; in execute_HDR_generalInfo_push1_items_test()
375 fixture->expected = 1; in test_HDR_generalInfo_push1_items()
382 * fixture) in execute_HDR_set_and_check_implicitConfirm_test() argument
384 return TEST_false(ossl_cmp_hdr_has_implicitConfirm(fixture->hdr)) in execute_HDR_set_and_check_implicitConfirm_test()
385 && TEST_true(ossl_cmp_hdr_set_implicitConfirm(fixture->hdr)) in execute_HDR_set_and_check_implicitConfirm_test()
386 && TEST_true(ossl_cmp_hdr_has_implicitConfirm(fixture->hdr)); in execute_HDR_set_and_check_implicitConfirm_test()
397 static int execute_HDR_init_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_init_test() argument
402 if (!TEST_int_eq(fixture->expected, in execute_HDR_init_test()
403 ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr))) in execute_HDR_init_test()
405 if (fixture->expected == 0) in execute_HDR_init_test()
408 if (!TEST_int_eq(ossl_cmp_hdr_get_pvno(fixture->hdr), OSSL_CMP_PVNO)) in execute_HDR_init_test()
411 header_nonce = ossl_cmp_hdr_get0_senderNonce(fixture->hdr); in execute_HDR_init_test()
413 fixture->cmp_ctx->senderNonce))) in execute_HDR_init_test()
415 header_transactionID = OSSL_CMP_HDR_get0_transactionID(fixture->hdr); in execute_HDR_init_test()
417 fixture->cmp_ctx->transactionID))) in execute_HDR_init_test()
420 header_nonce = OSSL_CMP_HDR_get0_recipNonce(fixture->hdr); in execute_HDR_init_test()
421 ctx_nonce = fixture->cmp_ctx->recipNonce; in execute_HDR_init_test()
437 fixture->expected = 1; in test_HDR_init_with_ref()
439 || !TEST_true(OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx, in test_HDR_init_with_ref()
441 tear_down(fixture); in test_HDR_init_with_ref()
442 fixture = NULL; in test_HDR_init_with_ref()
453 fixture->expected = 1; in test_HDR_init_with_subject()
456 || !TEST_true(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, in test_HDR_init_with_subject()
458 tear_down(fixture); in test_HDR_init_with_subject()
459 fixture = NULL; in test_HDR_init_with_subject()