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
82 if (!TEST_int_eq(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, sender), in execute_HDR_get0_senderNonce_test()
85 if (!TEST_int_eq(ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr), in execute_HDR_get0_senderNonce_test()
88 sn = ossl_cmp_hdr_get0_senderNonce(fixture->hdr); in execute_HDR_get0_senderNonce_test()
89 if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->cmp_ctx->senderNonce, sn), in execute_HDR_get0_senderNonce_test()
103 fixture->expected = 1; in test_HDR_get0_senderNonce()
108 static int execute_HDR_set1_sender_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_sender_test() argument
117 if (!TEST_int_eq(ossl_cmp_hdr_set1_sender(fixture->hdr, x509name), 1)) in execute_HDR_set1_sender_test()
120 if (!TEST_int_eq(fixture->hdr->sender->type, GEN_DIRNAME)) in execute_HDR_set1_sender_test()
123 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->sender->d.directoryName, in execute_HDR_set1_sender_test()
137 fixture->expected = 1; in test_HDR_set1_sender()
142 static int execute_HDR_set1_recipient_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_recipient_test() argument
151 if (!TEST_int_eq(ossl_cmp_hdr_set1_recipient(fixture->hdr, x509name), 1)) in execute_HDR_set1_recipient_test()
154 if (!TEST_int_eq(fixture->hdr->recipient->type, GEN_DIRNAME)) in execute_HDR_set1_recipient_test()
157 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->recipient->d.directoryName, in execute_HDR_set1_recipient_test()
171 fixture->expected = 1; in test_HDR_set1_recipient()
176 static int execute_HDR_update_messageTime_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_update_messageTime_test() argument
190 if (!TEST_true(ossl_cmp_hdr_update_messageTime(fixture->hdr))) in execute_HDR_update_messageTime_test()
192 if (!TEST_true(ASN1_TIME_to_tm(fixture->hdr->messageTime, &hdrtm))) in execute_HDR_update_messageTime_test()
209 fixture->expected = 1; in test_HDR_update_messageTime()
214 static int execute_HDR_set1_senderKID_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_set1_senderKID_test() argument
225 if (!TEST_int_eq(ossl_cmp_hdr_set1_senderKID(fixture->hdr, senderKID), 1)) in execute_HDR_set1_senderKID_test()
227 if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->hdr->senderKID, in execute_HDR_set1_senderKID_test()
239 fixture->expected = 1; in test_HDR_set1_senderKID()
244 static int execute_HDR_push0_freeText_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_push0_freeText_test() argument
254 if (!TEST_int_eq(ossl_cmp_hdr_push0_freeText(fixture->hdr, text), 1)) in execute_HDR_push0_freeText_test()
257 if (!TEST_true(text == sk_ASN1_UTF8STRING_value(fixture->hdr->freeText, 0))) in execute_HDR_push0_freeText_test()
270 fixture->expected = 1; in test_HDR_push0_freeText()
275 static int execute_HDR_push1_freeText_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_push1_freeText_test() argument
287 if (!TEST_int_eq(ossl_cmp_hdr_push1_freeText(fixture->hdr, text), 1)) in execute_HDR_push1_freeText_test()
290 pushed_text = sk_ASN1_UTF8STRING_value(fixture->hdr->freeText, 0); in execute_HDR_push1_freeText_test()
304 fixture->expected = 1; in test_HDR_push1_freeText()
310 execute_HDR_generalInfo_push0_item_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_generalInfo_push0_item_test() argument
317 if (!TEST_int_eq(ossl_cmp_hdr_generalInfo_push0_item(fixture->hdr, itav), in execute_HDR_generalInfo_push0_item_test()
321 if (!TEST_true(itav == sk_OSSL_CMP_ITAV_value(fixture->hdr->generalInfo, in execute_HDR_generalInfo_push0_item_test()
331 fixture->expected = 1; in test_HDR_generalInfo_push0_item()
337 execute_HDR_generalInfo_push1_items_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_generalInfo_push1_items_test() argument
367 if (!TEST_int_eq(ossl_cmp_hdr_generalInfo_push1_items(fixture->hdr, itavs), in execute_HDR_generalInfo_push1_items_test()
370 ginfo = fixture->hdr->generalInfo; in execute_HDR_generalInfo_push1_items_test()
390 fixture->expected = 1; in test_HDR_generalInfo_push1_items()
397 * fixture) in execute_HDR_set_and_check_implicitConfirm_test() argument
399 return TEST_false(ossl_cmp_hdr_has_implicitConfirm(fixture->hdr)) in execute_HDR_set_and_check_implicitConfirm_test()
400 && TEST_true(ossl_cmp_hdr_set_implicitConfirm(fixture->hdr)) in execute_HDR_set_and_check_implicitConfirm_test()
401 && TEST_true(ossl_cmp_hdr_has_implicitConfirm(fixture->hdr)); in execute_HDR_set_and_check_implicitConfirm_test()
411 static int execute_HDR_init_test(CMP_HDR_TEST_FIXTURE *fixture) in execute_HDR_init_test() argument
416 if (!TEST_int_eq(fixture->expected, in execute_HDR_init_test()
417 ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr))) in execute_HDR_init_test()
419 if (fixture->expected == 0) in execute_HDR_init_test()
422 if (!TEST_int_eq(ossl_cmp_hdr_get_pvno(fixture->hdr), OSSL_CMP_PVNO)) in execute_HDR_init_test()
425 header_nonce = ossl_cmp_hdr_get0_senderNonce(fixture->hdr); in execute_HDR_init_test()
427 fixture->cmp_ctx->senderNonce))) in execute_HDR_init_test()
429 header_transactionID = OSSL_CMP_HDR_get0_transactionID(fixture->hdr); in execute_HDR_init_test()
431 fixture->cmp_ctx->transactionID) == 0)) in execute_HDR_init_test()
434 header_nonce = OSSL_CMP_HDR_get0_recipNonce(fixture->hdr); in execute_HDR_init_test()
435 ctx_nonce = fixture->cmp_ctx->recipNonce; in execute_HDR_init_test()
451 fixture->expected = 1; in test_HDR_init_with_ref()
453 || !TEST_true(OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx, in test_HDR_init_with_ref()
455 tear_down(fixture); in test_HDR_init_with_ref()
456 fixture = NULL; in test_HDR_init_with_ref()
467 fixture->expected = 1; in test_HDR_init_with_subject()
470 || !TEST_true(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, in test_HDR_init_with_subject()
472 tear_down(fixture); in test_HDR_init_with_subject()
473 fixture = NULL; in test_HDR_init_with_subject()