edhoc 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -0
- package/binding.gyp +13 -11
- package/dist/crypto.d.ts +9 -2
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +112 -84
- package/dist/edhoc.d.ts +31 -9
- package/dist/edhoc.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/x509credentials.d.ts +20 -0
- package/dist/x509credentials.d.ts.map +1 -0
- package/dist/x509credentials.js +140 -0
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_bstr_type_types.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_decode.h +2 -2
- package/external/libedhoc/backends/cbor/include/backend_cbor_ead_encode.h +2 -2
- package/external/libedhoc/backends/cbor/include/backend_cbor_edhoc_types.h +48 -43
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_enc_structure_types.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_id_cred_x_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_info_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_int_type_types.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_1_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_2_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_3_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_4_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_message_error_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_2_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_3_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_decode.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_plaintext_4_encode.h +3 -3
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_decode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_encode.h +1 -1
- package/external/libedhoc/backends/cbor/include/backend_cbor_sig_structure_types.h +4 -4
- package/external/libedhoc/backends/cbor/include/backend_cbor_x509_types.h +93 -83
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_bstr_type_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_decode.c +27 -32
- package/external/libedhoc/backends/cbor/src/backend_cbor_ead_encode.c +27 -32
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_decode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_enc_structure_encode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_decode.c +63 -52
- package/external/libedhoc/backends/cbor/src/backend_cbor_id_cred_x_encode.c +62 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_decode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_info_encode.c +14 -23
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_int_type_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_decode.c +54 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_1_encode.c +54 -51
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_2_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_3_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_decode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_4_encode.c +11 -20
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_decode.c +36 -37
- package/external/libedhoc/backends/cbor/src/backend_cbor_message_error_encode.c +36 -37
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_decode.c +103 -80
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_2_encode.c +102 -79
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_decode.c +99 -76
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_3_encode.c +98 -75
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_decode.c +40 -41
- package/external/libedhoc/backends/cbor/src/backend_cbor_plaintext_4_encode.c +40 -41
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_decode.c +15 -24
- package/external/libedhoc/backends/cbor/src/backend_cbor_sig_structure_encode.c +15 -24
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_1/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode.c +69 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/TestProductionCode2.c +38 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- package/external/libedhoc/externals/Unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_2/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode.c +71 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/TestProductionCode2.c +40 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +16 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_2/test/test_runners/all_tests.c +19 -0
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.c +17 -0
- package/external/libedhoc/externals/Unity/examples/example_3/helper/UnityHelper.h +19 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_3/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode.c +69 -0
- package/external/libedhoc/externals/Unity/examples/example_3/test/TestProductionCode2.c +38 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.c +31 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode.h +10 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.c +18 -0
- package/external/libedhoc/externals/Unity/examples/example_4/src/ProductionCode2.h +9 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode.c +70 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/TestProductionCode2.c +42 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
- package/external/libedhoc/externals/Unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
- package/external/libedhoc/externals/Unity/examples/unity_config.h +251 -0
- package/external/libedhoc/externals/Unity/extras/bdd/src/unity_bdd.h +44 -0
- package/external/libedhoc/externals/Unity/extras/bdd/test/test_bdd.c +129 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.c +310 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture.h +95 -0
- package/external/libedhoc/externals/Unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/main/AllTests.c +20 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/template_fixture_tests.c +40 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_Test.c +246 -0
- package/external/libedhoc/externals/Unity/extras/fixture/test/unity_fixture_TestRunner.c +33 -0
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.c +203 -0
- package/external/libedhoc/externals/Unity/extras/memory/src/unity_memory.h +61 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_Test.c +326 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_memory_TestRunner.c +50 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.c +57 -0
- package/external/libedhoc/externals/Unity/extras/memory/test/unity_output_Spy.h +17 -0
- package/external/libedhoc/externals/Unity/src/unity.c +2501 -0
- package/external/libedhoc/externals/Unity/src/unity.h +698 -0
- package/external/libedhoc/externals/Unity/src/unity_internals.h +1183 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_cmd.c +61 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_def.c +57 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.c +55 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_head1.h +15 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_cmd.c +80 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_def.c +76 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.c +75 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_head1.h +13 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new1.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_new2.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_param.c +77 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run1.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_run2.c +89 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_mock_yaml.c +90 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new1.c +67 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_new2.c +70 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_param.c +58 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run1.c +67 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_run2.c +70 -0
- package/external/libedhoc/externals/Unity/test/expectdata/testsample_yaml.c +71 -0
- package/external/libedhoc/externals/Unity/test/testdata/CException.h +18 -0
- package/external/libedhoc/externals/Unity/test/testdata/Defs.h +16 -0
- package/external/libedhoc/externals/Unity/test/testdata/cmock.h +21 -0
- package/external/libedhoc/externals/Unity/test/testdata/mockMock.h +20 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGenerator.c +204 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorSmall.c +73 -0
- package/external/libedhoc/externals/Unity/test/testdata/testRunnerGeneratorWithMocks.c +200 -0
- package/external/libedhoc/externals/Unity/test/tests/self_assessment_utils.h +151 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_arrays.c +2941 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_core.c +375 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_doubles.c +1285 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_floats.c +1395 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers.c +2863 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_integers_64.c +783 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_memory.c +82 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterized.c +309 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_parameterizedDemo.c +28 -0
- package/external/libedhoc/externals/Unity/test/tests/test_unity_strings.c +330 -0
- package/external/libedhoc/externals/Unity/test/tests/types_for_test.h +21 -0
- package/external/libedhoc/externals/zcbor/include/zcbor_common.h +147 -60
- package/external/libedhoc/externals/zcbor/include/zcbor_decode.h +291 -202
- package/external/libedhoc/externals/zcbor/include/zcbor_encode.h +100 -156
- package/external/libedhoc/externals/zcbor/include/zcbor_print.h +165 -0
- package/external/libedhoc/externals/zcbor/samples/hello_world/src/main.c +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_decode.h +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_encode.h +1 -1
- package/external/libedhoc/externals/zcbor/samples/pet/include/pet_types.h +4 -4
- package/external/libedhoc/externals/zcbor/samples/pet/src/main.c +4 -4
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_decode.c +15 -24
- package/external/libedhoc/externals/zcbor/samples/pet/src/pet_encode.c +14 -23
- package/external/libedhoc/externals/zcbor/src/zcbor_common.c +202 -29
- package/external/libedhoc/externals/zcbor/src/zcbor_decode.c +633 -173
- package/external/libedhoc/externals/zcbor/src/zcbor_encode.c +71 -184
- package/external/libedhoc/externals/zcbor/tests/decode/test1_suit_old_formats/src/main.c +152 -153
- package/external/libedhoc/externals/zcbor/tests/decode/test2_suit/src/main.c +64 -64
- package/external/libedhoc/externals/zcbor/tests/decode/test3_simple/src/main.c +15 -16
- package/external/libedhoc/externals/zcbor/tests/decode/test5_corner_cases/src/main.c +228 -84
- package/external/libedhoc/externals/zcbor/tests/decode/test7_suit9_simple/src/main.c +9 -9
- package/external/libedhoc/externals/zcbor/tests/decode/test8_suit12/src/main.c +0 -1
- package/external/libedhoc/externals/zcbor/tests/decode/test9_manifest14/src/main.c +172 -173
- package/external/libedhoc/externals/zcbor/tests/encode/test1_suit/src/main.c +73 -73
- package/external/libedhoc/externals/zcbor/tests/encode/test2_simple/src/main.c +1 -2
- package/external/libedhoc/externals/zcbor/tests/encode/test3_corner_cases/src/main.c +83 -56
- package/external/libedhoc/externals/zcbor/tests/encode/test4_senml/src/main.c +15 -16
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_everything.c +12 -0
- package/external/libedhoc/externals/zcbor/tests/fuzz/fuzz_manifest12.c +69 -69
- package/external/libedhoc/externals/zcbor/tests/unit/test1_unit_tests/src/main.c +448 -55
- package/external/libedhoc/externals/zcbor/tests/unit/test3_float16/src/main.c +49 -48
- package/external/libedhoc/include/edhoc.h +348 -54
- package/external/libedhoc/include/edhoc_common.h +289 -0
- package/external/libedhoc/include/edhoc_context.h +60 -35
- package/external/libedhoc/include/edhoc_credentials.h +55 -7
- package/external/libedhoc/include/edhoc_crypto.h +10 -10
- package/external/libedhoc/include/edhoc_ead.h +13 -10
- package/external/libedhoc/include/edhoc_macros.h +20 -11
- package/external/libedhoc/include/edhoc_values.h +2 -2
- package/external/libedhoc/library/edhoc.c +70 -36
- package/external/libedhoc/library/edhoc_common.c +1314 -0
- package/external/libedhoc/library/edhoc_exporter.c +45 -46
- package/external/libedhoc/library/edhoc_message_1.c +107 -72
- package/external/libedhoc/library/edhoc_message_2.c +396 -1693
- package/external/libedhoc/library/edhoc_message_3.c +465 -1656
- package/external/libedhoc/library/edhoc_message_4.c +93 -91
- package/external/libedhoc/library/edhoc_message_error.c +41 -41
- package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_0.h → cipher_suite_0.h} +131 -134
- package/external/libedhoc/tests/include/{cipher_suites/cipher_suite_2.h → cipher_suite_2.h} +139 -140
- package/external/libedhoc/tests/include/{edhoc_trace_1/test_vector_1.h → test_vector_rfc9529_chapter_2.h} +786 -738
- package/external/libedhoc/tests/include/{edhoc_trace_2/test_vector_2.h → test_vector_rfc9529_chapter_3.h} +14 -10
- package/external/libedhoc/tests/include/{x509_chain_cs_0/test_vector_x5chain_cs_0.h → test_vector_x5chain_sign_keys_suite_0.h} +137 -140
- package/external/libedhoc/tests/include/{x509_chain_cs_2/test_vector_x5chain_cs_2.h → test_vector_x5chain_sign_keys_suite_2.h} +7 -8
- package/external/libedhoc/tests/include/{x509_chain_cs_2_static_dh/test_vector_x5chain_cs_2_static_dh.h → test_vector_x5chain_static_dh_keys_suite_2.h} +7 -8
- package/external/libedhoc/tests/include/{x509_hash_cs_2/test_vector_x5t_cs_2.h → test_vector_x5t_sign_keys_suite_2.h} +6 -7
- package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_0.c → cipher_suite_0.c} +445 -447
- package/external/libedhoc/tests/src/{cipher_suites/cipher_suite_2.c → cipher_suite_2.c} +600 -600
- package/external/libedhoc/tests/src/module_test_api.c +430 -0
- package/external/libedhoc/tests/src/module_test_cipher_suite_0.c +395 -0
- package/external/libedhoc/tests/src/module_test_cipher_suite_2.c +392 -0
- package/external/libedhoc/tests/src/{error_message/test_edhoc_error_message.c → module_test_error_message.c} +94 -69
- package/external/libedhoc/tests/src/module_test_main.c +49 -0
- package/external/libedhoc/tests/src/{cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.c → module_test_rfc9528_suites_negotiation.c} +224 -227
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_2.c +2681 -0
- package/external/libedhoc/tests/src/module_test_rfc9529_chapter_3.c +1635 -0
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_0.c +1135 -0
- package/external/libedhoc/tests/src/module_test_x5chain_sign_keys_suite_2.c +1249 -0
- package/external/libedhoc/tests/src/module_test_x5chain_static_dh_keys_suite_2.c +798 -0
- package/external/libedhoc/tests/src/module_test_x5t_sign_keys_suite_2.c +956 -0
- package/include/EdhocComposeAsyncWorker.h +8 -6
- package/include/EdhocCredentialManager.h +16 -11
- package/include/EdhocCryptoManager.h +28 -21
- package/include/EdhocEadManager.h +3 -6
- package/include/{EdhocExportAsyncWorker.h → EdhocExportOscoreAsyncWorker.h} +20 -17
- package/include/EdhocKeyExporterAsyncWorker.h +76 -0
- package/include/EdhocKeyUpdateAsyncWorker.h +72 -0
- package/include/EdhocProcessAsyncWorker.h +14 -10
- package/include/LibEDHOC.h +44 -20
- package/include/UserContext.h +7 -9
- package/include/Utils.h +31 -27
- package/package.json +14 -3
- package/prebuilds/android-arm/edhoc.armv7.node +0 -0
- package/prebuilds/android-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/darwin-arm64/edhoc.node +0 -0
- package/prebuilds/darwin-x64/edhoc.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv6.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv7.node +0 -0
- package/prebuilds/linux-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/linux-x64/edhoc.glibc.node +0 -0
- package/prebuilds/linux-x64/edhoc.musl.node +0 -0
- package/prebuilds/win32-ia32/edhoc.node +0 -0
- package/prebuilds/win32-x64/edhoc.node +0 -0
- package/src/EdhocComposeAsyncWorker.cpp +18 -35
- package/src/EdhocCredentialManager.cpp +160 -187
- package/src/EdhocCryptoManager.cpp +386 -586
- package/src/EdhocEadManager.cpp +10 -18
- package/src/EdhocExportOscoreAsyncWorker.cpp +77 -0
- package/src/EdhocKeyExporterAsyncWorker.cpp +49 -0
- package/src/EdhocKeyUpdateAsyncWorker.cpp +41 -0
- package/src/EdhocProcessAsyncWorker.cpp +72 -19
- package/src/LibEDHOC.cpp +213 -174
- package/src/Suites.cpp +39 -72
- package/src/Utils.cpp +32 -56
- package/test/basic.test.ts +64 -0
- package/test/vectors.test.ts +111 -0
- package/dist/credentials.d.ts +0 -16
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js +0 -84
- package/external/libedhoc/externals/zcbor/include/zcbor_debug.h +0 -69
- package/external/libedhoc/tests/include/cipher_suite_negotiation/test_edhoc_cipher_suite_negotiation.h +0 -37
- package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_0.h +0 -48
- package/external/libedhoc/tests/include/cipher_suites/test_cipher_suite_2.h +0 -48
- package/external/libedhoc/tests/include/edhoc_trace_1/authentication_credentials_1.h +0 -60
- package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_1.h +0 -208
- package/external/libedhoc/tests/include/edhoc_trace_1/test_edhoc_handshake_ead_1.h +0 -59
- package/external/libedhoc/tests/include/edhoc_trace_2/authentication_credentials_2.h +0 -60
- package/external/libedhoc/tests/include/edhoc_trace_2/test_edhoc_handshake_2.h +0 -199
- package/external/libedhoc/tests/include/error_message/test_edhoc_error_message.h +0 -48
- package/external/libedhoc/tests/include/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.h +0 -92
- package/external/libedhoc/tests/include/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.h +0 -96
- package/external/libedhoc/tests/include/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.h +0 -58
- package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.h +0 -56
- package/external/libedhoc/tests/include/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.h +0 -57
- package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.h +0 -59
- package/external/libedhoc/tests/include/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.h +0 -57
- package/external/libedhoc/tests/include/x509_hash_cs_2/authentication_credentials_x5t_cs_2.h +0 -60
- package/external/libedhoc/tests/include/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.h +0 -57
- package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_0.c +0 -475
- package/external/libedhoc/tests/src/cipher_suites/test_cipher_suite_2.c +0 -473
- package/external/libedhoc/tests/src/edhoc_trace_1/authentication_credentials_1.c +0 -252
- package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_1.c +0 -1829
- package/external/libedhoc/tests/src/edhoc_trace_1/test_edhoc_handshake_ead_1.c +0 -1247
- package/external/libedhoc/tests/src/edhoc_trace_2/authentication_credentials_2.c +0 -170
- package/external/libedhoc/tests/src/edhoc_trace_2/test_edhoc_handshake_2.c +0 -1783
- package/external/libedhoc/tests/src/tests.c +0 -228
- package/external/libedhoc/tests/src/x509_chain_cs_0/authentication_credentials_x5chain_cs_0.c +0 -332
- package/external/libedhoc/tests/src/x509_chain_cs_0/test_edhoc_handshake_x5chain_cs_0.c +0 -936
- package/external/libedhoc/tests/src/x509_chain_cs_2/authentication_credentials_x5chain_cs_2.c +0 -166
- package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2.c +0 -587
- package/external/libedhoc/tests/src/x509_chain_cs_2/test_edhoc_handshake_x5chain_cs_2_ead.c +0 -917
- package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/authentication_credentials_x5chain_cs_2_static_dh.c +0 -186
- package/external/libedhoc/tests/src/x509_chain_cs_2_static_dh/test_edhoc_handshake_x5chain_cs_2_static_dh_ead.c +0 -743
- package/external/libedhoc/tests/src/x509_hash_cs_2/authentication_credentials_x5t_cs_2.c +0 -261
- package/external/libedhoc/tests/src/x509_hash_cs_2/test_edhoc_handshake_x5t_cs_2_ead.c +0 -854
- package/src/EdhocExportAsyncWorker.cpp +0 -82
|
@@ -0,0 +1,1395 @@
|
|
|
1
|
+
/* =========================================================================
|
|
2
|
+
Unity - A Test Framework for C
|
|
3
|
+
ThrowTheSwitch.org
|
|
4
|
+
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
5
|
+
SPDX-License-Identifier: MIT
|
|
6
|
+
========================================================================= */
|
|
7
|
+
|
|
8
|
+
#include "unity.h"
|
|
9
|
+
#define TEST_INSTANCES
|
|
10
|
+
#include "self_assessment_utils.h"
|
|
11
|
+
|
|
12
|
+
static int SetToOneToFailInTearDown;
|
|
13
|
+
static int SetToOneMeanWeAlreadyCheckedThisGuy;
|
|
14
|
+
|
|
15
|
+
void setUp(void)
|
|
16
|
+
{
|
|
17
|
+
SetToOneToFailInTearDown = 0;
|
|
18
|
+
SetToOneMeanWeAlreadyCheckedThisGuy = 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void tearDown(void)
|
|
22
|
+
{
|
|
23
|
+
endPutcharSpy(); /* Stop suppressing test output */
|
|
24
|
+
if (SetToOneToFailInTearDown == 1)
|
|
25
|
+
{
|
|
26
|
+
/* These will be skipped internally if already failed/ignored */
|
|
27
|
+
TEST_FAIL_MESSAGE("<= Failed in tearDown");
|
|
28
|
+
TEST_IGNORE_MESSAGE("<= Ignored in tearDown");
|
|
29
|
+
}
|
|
30
|
+
if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
|
|
31
|
+
{
|
|
32
|
+
UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
|
|
33
|
+
UNITY_OUTPUT_CHAR('\n');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void testFloatsWithinDelta(void)
|
|
38
|
+
{
|
|
39
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
40
|
+
TEST_IGNORE();
|
|
41
|
+
#else
|
|
42
|
+
TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f);
|
|
43
|
+
TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f);
|
|
44
|
+
TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f);
|
|
45
|
+
TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f);
|
|
46
|
+
|
|
47
|
+
EXPECT_ABORT_BEGIN
|
|
48
|
+
TEST_ASSERT_FLOAT_NOT_WITHIN(0.05f, 9273.2549f, 9273.2049f);
|
|
49
|
+
VERIFY_FAILS_END
|
|
50
|
+
#endif
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void testFloatsNotWithinDelta(void)
|
|
54
|
+
{
|
|
55
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
56
|
+
TEST_IGNORE();
|
|
57
|
+
#else
|
|
58
|
+
TEST_ASSERT_FLOAT_NOT_WITHIN(0.05f, 9273.2649f, 9273.2049f);
|
|
59
|
+
|
|
60
|
+
EXPECT_ABORT_BEGIN
|
|
61
|
+
TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f);
|
|
62
|
+
VERIFY_FAILS_END
|
|
63
|
+
#endif
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void testFloatsEqual(void)
|
|
67
|
+
{
|
|
68
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
69
|
+
TEST_IGNORE();
|
|
70
|
+
#else
|
|
71
|
+
TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f);
|
|
72
|
+
TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f);
|
|
73
|
+
TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f);
|
|
74
|
+
TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f);
|
|
75
|
+
|
|
76
|
+
EXPECT_ABORT_BEGIN
|
|
77
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(-726.93724f, -726.9374f);
|
|
78
|
+
VERIFY_FAILS_END
|
|
79
|
+
#endif
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void testFloatsNotEqual(void)
|
|
83
|
+
{
|
|
84
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
85
|
+
TEST_IGNORE();
|
|
86
|
+
#else
|
|
87
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(9273.9649f, 9273.0049f);
|
|
88
|
+
|
|
89
|
+
EXPECT_ABORT_BEGIN
|
|
90
|
+
TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f);
|
|
91
|
+
VERIFY_FAILS_END
|
|
92
|
+
#endif
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void testFloatsNotEqualNegative1(void)
|
|
96
|
+
{
|
|
97
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
98
|
+
TEST_IGNORE();
|
|
99
|
+
#else
|
|
100
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(-9273.9649f, -9273.0049f);
|
|
101
|
+
|
|
102
|
+
EXPECT_ABORT_BEGIN
|
|
103
|
+
TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f);
|
|
104
|
+
VERIFY_FAILS_END
|
|
105
|
+
#endif
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void testFloatsNotEqualNegative2(void)
|
|
109
|
+
{
|
|
110
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
111
|
+
TEST_IGNORE();
|
|
112
|
+
#else
|
|
113
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(-9273.0049f, -9273.9649f);
|
|
114
|
+
|
|
115
|
+
EXPECT_ABORT_BEGIN
|
|
116
|
+
TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f);
|
|
117
|
+
VERIFY_FAILS_END
|
|
118
|
+
#endif
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void testFloatsNotEqualActualNaN(void)
|
|
122
|
+
{
|
|
123
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
124
|
+
TEST_IGNORE();
|
|
125
|
+
#else
|
|
126
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(85.963f, 0.0f / f_zero);
|
|
127
|
+
|
|
128
|
+
EXPECT_ABORT_BEGIN
|
|
129
|
+
TEST_ASSERT_EQUAL_FLOAT(85.963f, 0.0f / f_zero);
|
|
130
|
+
VERIFY_FAILS_END
|
|
131
|
+
#endif
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void testFloatsNotEqualExpectedNaN(void)
|
|
135
|
+
{
|
|
136
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
137
|
+
TEST_IGNORE();
|
|
138
|
+
#else
|
|
139
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 85.963f);
|
|
140
|
+
|
|
141
|
+
EXPECT_ABORT_BEGIN
|
|
142
|
+
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 85.963f);
|
|
143
|
+
VERIFY_FAILS_END
|
|
144
|
+
#endif
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
void testFloatsEqualBothNaN(void)
|
|
148
|
+
{
|
|
149
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
150
|
+
TEST_IGNORE();
|
|
151
|
+
#else
|
|
152
|
+
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
153
|
+
|
|
154
|
+
EXPECT_ABORT_BEGIN
|
|
155
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
156
|
+
VERIFY_FAILS_END
|
|
157
|
+
#endif
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
void testFloatsNotEqualInfNaN(void)
|
|
161
|
+
{
|
|
162
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
163
|
+
TEST_IGNORE();
|
|
164
|
+
#else
|
|
165
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero);
|
|
166
|
+
|
|
167
|
+
EXPECT_ABORT_BEGIN
|
|
168
|
+
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero);
|
|
169
|
+
VERIFY_FAILS_END
|
|
170
|
+
#endif
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
void testFloatsNotEqualNaNInf(void)
|
|
174
|
+
{
|
|
175
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
176
|
+
TEST_IGNORE();
|
|
177
|
+
#else
|
|
178
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero);
|
|
179
|
+
|
|
180
|
+
EXPECT_ABORT_BEGIN
|
|
181
|
+
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero);
|
|
182
|
+
VERIFY_FAILS_END
|
|
183
|
+
#endif
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
void testFloatsNotEqualActualInf(void)
|
|
187
|
+
{
|
|
188
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
189
|
+
TEST_IGNORE();
|
|
190
|
+
#else
|
|
191
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(321.642f, 1.0f / f_zero);
|
|
192
|
+
|
|
193
|
+
EXPECT_ABORT_BEGIN
|
|
194
|
+
TEST_ASSERT_EQUAL_FLOAT(321.642f, 1.0f / f_zero);
|
|
195
|
+
VERIFY_FAILS_END
|
|
196
|
+
#endif
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void testFloatsNotEqualExpectedInf(void)
|
|
200
|
+
{
|
|
201
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
202
|
+
TEST_IGNORE();
|
|
203
|
+
#else
|
|
204
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 321.642f);
|
|
205
|
+
|
|
206
|
+
EXPECT_ABORT_BEGIN
|
|
207
|
+
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 321.642f);
|
|
208
|
+
VERIFY_FAILS_END
|
|
209
|
+
#endif
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
void testFloatsEqualBothInf(void)
|
|
213
|
+
{
|
|
214
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
215
|
+
TEST_IGNORE();
|
|
216
|
+
#else
|
|
217
|
+
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
218
|
+
|
|
219
|
+
EXPECT_ABORT_BEGIN
|
|
220
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
221
|
+
VERIFY_FAILS_END
|
|
222
|
+
#endif
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void testFloatsNotEqualPlusMinusInf(void)
|
|
226
|
+
{
|
|
227
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
228
|
+
TEST_IGNORE();
|
|
229
|
+
#else
|
|
230
|
+
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
|
231
|
+
|
|
232
|
+
EXPECT_ABORT_BEGIN
|
|
233
|
+
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
|
234
|
+
VERIFY_FAILS_END
|
|
235
|
+
#endif
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
void testFloatsGreaterThan(void)
|
|
239
|
+
{
|
|
240
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
241
|
+
TEST_IGNORE();
|
|
242
|
+
#else
|
|
243
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 2.0f);
|
|
244
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f, 1.0f);
|
|
245
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(-2.0f, -1.0f);
|
|
246
|
+
#endif
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
void testFloatsGreaterThanInf(void)
|
|
250
|
+
{
|
|
251
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
252
|
+
TEST_IGNORE();
|
|
253
|
+
#else
|
|
254
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 1.0f / f_zero);
|
|
255
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, 1.0f / f_zero);
|
|
256
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, 1.0f);
|
|
257
|
+
#endif
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
void testFloatsNotGreaterThan(void)
|
|
261
|
+
{
|
|
262
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
263
|
+
TEST_IGNORE();
|
|
264
|
+
#else
|
|
265
|
+
EXPECT_ABORT_BEGIN
|
|
266
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(2.0f, 1.0f);
|
|
267
|
+
VERIFY_FAILS_END
|
|
268
|
+
#endif
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
void testFloatsNotGreaterThanNanActual(void)
|
|
272
|
+
{
|
|
273
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
274
|
+
TEST_IGNORE();
|
|
275
|
+
#else
|
|
276
|
+
EXPECT_ABORT_BEGIN
|
|
277
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 0.0f / f_zero);
|
|
278
|
+
VERIFY_FAILS_END
|
|
279
|
+
#endif
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
void testFloatsNotGreaterThanNanThreshold(void)
|
|
283
|
+
{
|
|
284
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
285
|
+
TEST_IGNORE();
|
|
286
|
+
#else
|
|
287
|
+
EXPECT_ABORT_BEGIN
|
|
288
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(0.0f / f_zero, 1.0f);
|
|
289
|
+
VERIFY_FAILS_END
|
|
290
|
+
#endif
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
void testFloatsNotGreaterThanNanBoth(void)
|
|
294
|
+
{
|
|
295
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
296
|
+
TEST_IGNORE();
|
|
297
|
+
#else
|
|
298
|
+
EXPECT_ABORT_BEGIN
|
|
299
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
300
|
+
VERIFY_FAILS_END
|
|
301
|
+
#endif
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
void testFloatsNotGreaterThanInfActual(void)
|
|
305
|
+
{
|
|
306
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
307
|
+
TEST_IGNORE();
|
|
308
|
+
#else
|
|
309
|
+
EXPECT_ABORT_BEGIN
|
|
310
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f / f_zero, 1.0f);
|
|
311
|
+
VERIFY_FAILS_END
|
|
312
|
+
#endif
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
void testFloatsNotGreaterThanNegInf(void)
|
|
316
|
+
{
|
|
317
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
318
|
+
TEST_IGNORE();
|
|
319
|
+
#else
|
|
320
|
+
EXPECT_ABORT_BEGIN
|
|
321
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, -1.0f / f_zero);
|
|
322
|
+
VERIFY_FAILS_END
|
|
323
|
+
#endif
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
void testFloatsNotGreaterThanBothInf(void)
|
|
327
|
+
{
|
|
328
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
329
|
+
TEST_IGNORE();
|
|
330
|
+
#else
|
|
331
|
+
EXPECT_ABORT_BEGIN
|
|
332
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
333
|
+
VERIFY_FAILS_END
|
|
334
|
+
#endif
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
void testFloatsNotGreaterThanBothNegInf(void)
|
|
338
|
+
{
|
|
339
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
340
|
+
TEST_IGNORE();
|
|
341
|
+
#else
|
|
342
|
+
EXPECT_ABORT_BEGIN
|
|
343
|
+
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
|
344
|
+
VERIFY_FAILS_END
|
|
345
|
+
#endif
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
void testFloatsGreaterOrEqual(void)
|
|
349
|
+
{
|
|
350
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
351
|
+
TEST_IGNORE();
|
|
352
|
+
#else
|
|
353
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 2.0f);
|
|
354
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(2.0f, 2.0f);
|
|
355
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f, 1.0f);
|
|
356
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-2.0f, -1.0f);
|
|
357
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-2.0f, -2.0f);
|
|
358
|
+
#endif
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
void testFloatsGreaterOrEqualInf(void)
|
|
362
|
+
{
|
|
363
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
364
|
+
TEST_IGNORE();
|
|
365
|
+
#else
|
|
366
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 1.0f / f_zero);
|
|
367
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f / f_zero);
|
|
368
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f);
|
|
369
|
+
#endif
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
void testFloatsNotGreaterOrEqual(void)
|
|
373
|
+
{
|
|
374
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
375
|
+
TEST_IGNORE();
|
|
376
|
+
#else
|
|
377
|
+
EXPECT_ABORT_BEGIN
|
|
378
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(2.0f, 1.0f);
|
|
379
|
+
VERIFY_FAILS_END
|
|
380
|
+
#endif
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
void testFloatsNotGreaterOrEqualNanActual(void)
|
|
384
|
+
{
|
|
385
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
386
|
+
TEST_IGNORE();
|
|
387
|
+
#else
|
|
388
|
+
EXPECT_ABORT_BEGIN
|
|
389
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 0.0f / f_zero);
|
|
390
|
+
VERIFY_FAILS_END
|
|
391
|
+
#endif
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
void testFloatsNotGreaterOrEqualNanThreshold(void)
|
|
395
|
+
{
|
|
396
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
397
|
+
TEST_IGNORE();
|
|
398
|
+
#else
|
|
399
|
+
EXPECT_ABORT_BEGIN
|
|
400
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(0.0f / f_zero, 1.0f);
|
|
401
|
+
VERIFY_FAILS_END
|
|
402
|
+
#endif
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
void testFloatsGreaterOrEqualNanBoth(void)
|
|
406
|
+
{
|
|
407
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
408
|
+
TEST_IGNORE();
|
|
409
|
+
#else
|
|
410
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
411
|
+
#endif
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
void testFloatsNotGreaterOrEqualInfActual(void)
|
|
415
|
+
{
|
|
416
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
417
|
+
TEST_IGNORE();
|
|
418
|
+
#else
|
|
419
|
+
EXPECT_ABORT_BEGIN
|
|
420
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f);
|
|
421
|
+
VERIFY_FAILS_END
|
|
422
|
+
#endif
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
void testFloatsNotGreaterOrEqualNegInf(void)
|
|
426
|
+
{
|
|
427
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
428
|
+
TEST_IGNORE();
|
|
429
|
+
#else
|
|
430
|
+
EXPECT_ABORT_BEGIN
|
|
431
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, -1.0f / f_zero);
|
|
432
|
+
VERIFY_FAILS_END
|
|
433
|
+
#endif
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
void testFloatsGreaterOrEqualBothInf(void)
|
|
437
|
+
{
|
|
438
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
439
|
+
TEST_IGNORE();
|
|
440
|
+
#else
|
|
441
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
442
|
+
#endif
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
void testFloatsGreaterOrEqualBothNegInf(void)
|
|
446
|
+
{
|
|
447
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
448
|
+
TEST_IGNORE();
|
|
449
|
+
#else
|
|
450
|
+
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
|
451
|
+
#endif
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
void testFloatsLessThan(void)
|
|
455
|
+
{
|
|
456
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
457
|
+
TEST_IGNORE();
|
|
458
|
+
#else
|
|
459
|
+
TEST_ASSERT_LESS_THAN_FLOAT(2.0f, 1.0f);
|
|
460
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, -1.0f);
|
|
461
|
+
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f, -2.0f);
|
|
462
|
+
#endif
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
void testFloatsLessThanInf(void)
|
|
466
|
+
{
|
|
467
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
468
|
+
TEST_IGNORE();
|
|
469
|
+
#else
|
|
470
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, 1.0f);
|
|
471
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
|
472
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, -1.0f / f_zero);
|
|
473
|
+
#endif
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
void testFloatsNotLessThan(void)
|
|
477
|
+
{
|
|
478
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
479
|
+
TEST_IGNORE();
|
|
480
|
+
#else
|
|
481
|
+
EXPECT_ABORT_BEGIN
|
|
482
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 2.0f);
|
|
483
|
+
VERIFY_FAILS_END
|
|
484
|
+
#endif
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
void testFloatsNotLessThanNanActual(void)
|
|
488
|
+
{
|
|
489
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
490
|
+
TEST_IGNORE();
|
|
491
|
+
#else
|
|
492
|
+
EXPECT_ABORT_BEGIN
|
|
493
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 0.0f / f_zero);
|
|
494
|
+
VERIFY_FAILS_END
|
|
495
|
+
#endif
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
void testFloatsNotLessThanNanThreshold(void)
|
|
499
|
+
{
|
|
500
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
501
|
+
TEST_IGNORE();
|
|
502
|
+
#else
|
|
503
|
+
EXPECT_ABORT_BEGIN
|
|
504
|
+
TEST_ASSERT_LESS_THAN_FLOAT(0.0f / f_zero, 1.0f);
|
|
505
|
+
VERIFY_FAILS_END
|
|
506
|
+
#endif
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
void testFloatsNotLessThanNanBoth(void)
|
|
510
|
+
{
|
|
511
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
512
|
+
TEST_IGNORE();
|
|
513
|
+
#else
|
|
514
|
+
EXPECT_ABORT_BEGIN
|
|
515
|
+
TEST_ASSERT_LESS_THAN_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
516
|
+
VERIFY_FAILS_END
|
|
517
|
+
#endif
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
void testFloatsNotLessThanInf(void)
|
|
521
|
+
{
|
|
522
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
523
|
+
TEST_IGNORE();
|
|
524
|
+
#else
|
|
525
|
+
EXPECT_ABORT_BEGIN
|
|
526
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 1.0f / f_zero);
|
|
527
|
+
VERIFY_FAILS_END
|
|
528
|
+
#endif
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
void testFloatsNotLessThanNegInf(void)
|
|
532
|
+
{
|
|
533
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
534
|
+
TEST_IGNORE();
|
|
535
|
+
#else
|
|
536
|
+
EXPECT_ABORT_BEGIN
|
|
537
|
+
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f / f_zero, 1.0f);
|
|
538
|
+
VERIFY_FAILS_END
|
|
539
|
+
#endif
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
void testFloatsNotLessThanBothInf(void)
|
|
543
|
+
{
|
|
544
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
545
|
+
TEST_IGNORE();
|
|
546
|
+
#else
|
|
547
|
+
EXPECT_ABORT_BEGIN
|
|
548
|
+
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
549
|
+
VERIFY_FAILS_END
|
|
550
|
+
#endif
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
void testFloatsNotLessThanBothNegInf(void)
|
|
554
|
+
{
|
|
555
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
556
|
+
TEST_IGNORE();
|
|
557
|
+
#else
|
|
558
|
+
EXPECT_ABORT_BEGIN
|
|
559
|
+
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
|
560
|
+
VERIFY_FAILS_END
|
|
561
|
+
#endif
|
|
562
|
+
}
|
|
563
|
+
void testFloatsLessOrEqual(void)
|
|
564
|
+
{
|
|
565
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
566
|
+
TEST_IGNORE();
|
|
567
|
+
#else
|
|
568
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(2.0f, 1.0f);
|
|
569
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(2.0f, 2.0f);
|
|
570
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, -1.0f);
|
|
571
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f, -2.0f);
|
|
572
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-2.0f, -2.0f);
|
|
573
|
+
#endif
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
void testFloatsLessOrEqualInf(void)
|
|
577
|
+
{
|
|
578
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
579
|
+
TEST_IGNORE();
|
|
580
|
+
#else
|
|
581
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f);
|
|
582
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
|
583
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, -1.0f / f_zero);
|
|
584
|
+
#endif
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
void testFloatsNotLessOrEqual(void)
|
|
588
|
+
{
|
|
589
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
590
|
+
TEST_IGNORE();
|
|
591
|
+
#else
|
|
592
|
+
EXPECT_ABORT_BEGIN
|
|
593
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 2.0f);
|
|
594
|
+
VERIFY_FAILS_END
|
|
595
|
+
#endif
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
void testFloatsNotLessOrEqualNanActual(void)
|
|
599
|
+
{
|
|
600
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
601
|
+
TEST_IGNORE();
|
|
602
|
+
#else
|
|
603
|
+
EXPECT_ABORT_BEGIN
|
|
604
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 0.0f / f_zero);
|
|
605
|
+
VERIFY_FAILS_END
|
|
606
|
+
#endif
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
void testFloatsNotLessOrEqualNanThreshold(void)
|
|
610
|
+
{
|
|
611
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
612
|
+
TEST_IGNORE();
|
|
613
|
+
#else
|
|
614
|
+
EXPECT_ABORT_BEGIN
|
|
615
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(0.0f / f_zero, 1.0f);
|
|
616
|
+
VERIFY_FAILS_END
|
|
617
|
+
#endif
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
void testFloatsLessOrEqualNanBoth(void)
|
|
621
|
+
{
|
|
622
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
623
|
+
TEST_IGNORE();
|
|
624
|
+
#else
|
|
625
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
|
626
|
+
#endif
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
void testFloatsNotLessOrEqualInf(void)
|
|
630
|
+
{
|
|
631
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
632
|
+
TEST_IGNORE();
|
|
633
|
+
#else
|
|
634
|
+
EXPECT_ABORT_BEGIN
|
|
635
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 1.0f / f_zero);
|
|
636
|
+
VERIFY_FAILS_END
|
|
637
|
+
#endif
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
void testFloatsNotLessOrEqualNegInf(void)
|
|
641
|
+
{
|
|
642
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
643
|
+
TEST_IGNORE();
|
|
644
|
+
#else
|
|
645
|
+
EXPECT_ABORT_BEGIN
|
|
646
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f);
|
|
647
|
+
VERIFY_FAILS_END
|
|
648
|
+
#endif
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
void testFloatsLessOrEqualBothInf(void)
|
|
652
|
+
{
|
|
653
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
654
|
+
TEST_IGNORE();
|
|
655
|
+
#else
|
|
656
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
|
657
|
+
#endif
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
void testFloatsLessOrEqualBothNegInf(void)
|
|
661
|
+
{
|
|
662
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
663
|
+
TEST_IGNORE();
|
|
664
|
+
#else
|
|
665
|
+
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
|
666
|
+
#endif
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
void testFloatIsPosInf1(void)
|
|
670
|
+
{
|
|
671
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
672
|
+
TEST_IGNORE();
|
|
673
|
+
#else
|
|
674
|
+
TEST_ASSERT_FLOAT_IS_INF(2.0f / f_zero);
|
|
675
|
+
#endif
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
void testFloatIsPosInf2(void)
|
|
679
|
+
{
|
|
680
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
681
|
+
TEST_IGNORE();
|
|
682
|
+
#else
|
|
683
|
+
EXPECT_ABORT_BEGIN
|
|
684
|
+
TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f / f_zero);
|
|
685
|
+
VERIFY_FAILS_END
|
|
686
|
+
#endif
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
void testFloatIsNegInf1(void)
|
|
690
|
+
{
|
|
691
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
692
|
+
TEST_IGNORE();
|
|
693
|
+
#else
|
|
694
|
+
TEST_ASSERT_FLOAT_IS_NEG_INF(-3.0f / f_zero);
|
|
695
|
+
#endif
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
void testFloatIsNegInf2(void)
|
|
699
|
+
{
|
|
700
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
701
|
+
TEST_IGNORE();
|
|
702
|
+
#else
|
|
703
|
+
EXPECT_ABORT_BEGIN
|
|
704
|
+
TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(-3.0f / f_zero);
|
|
705
|
+
VERIFY_FAILS_END
|
|
706
|
+
#endif
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
void testFloatIsNotPosInf1(void)
|
|
710
|
+
{
|
|
711
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
712
|
+
TEST_IGNORE();
|
|
713
|
+
#else
|
|
714
|
+
EXPECT_ABORT_BEGIN
|
|
715
|
+
TEST_ASSERT_FLOAT_IS_INF(2.0f);
|
|
716
|
+
VERIFY_FAILS_END
|
|
717
|
+
#endif
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
void testFloatIsNotPosInf2(void)
|
|
721
|
+
{
|
|
722
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
723
|
+
TEST_IGNORE();
|
|
724
|
+
#else
|
|
725
|
+
TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f);
|
|
726
|
+
#endif
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
void testFloatIsNotNegInf(void)
|
|
730
|
+
{
|
|
731
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
732
|
+
TEST_IGNORE();
|
|
733
|
+
#else
|
|
734
|
+
EXPECT_ABORT_BEGIN
|
|
735
|
+
TEST_ASSERT_FLOAT_IS_NEG_INF(-999.876f);
|
|
736
|
+
VERIFY_FAILS_END
|
|
737
|
+
#endif
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
void testFloatIsNan1(void)
|
|
741
|
+
{
|
|
742
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
743
|
+
TEST_IGNORE();
|
|
744
|
+
#else
|
|
745
|
+
TEST_ASSERT_FLOAT_IS_NAN(0.0f / f_zero);
|
|
746
|
+
#endif
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
void testFloatIsNan2(void)
|
|
750
|
+
{
|
|
751
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
752
|
+
TEST_IGNORE();
|
|
753
|
+
#else
|
|
754
|
+
EXPECT_ABORT_BEGIN
|
|
755
|
+
TEST_ASSERT_FLOAT_IS_NOT_NAN(0.0f / f_zero);
|
|
756
|
+
VERIFY_FAILS_END
|
|
757
|
+
#endif
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
void testFloatIsNotNan1(void)
|
|
761
|
+
{
|
|
762
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
763
|
+
TEST_IGNORE();
|
|
764
|
+
#else
|
|
765
|
+
EXPECT_ABORT_BEGIN
|
|
766
|
+
TEST_ASSERT_FLOAT_IS_NAN(234.9f);
|
|
767
|
+
VERIFY_FAILS_END
|
|
768
|
+
#endif
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
void testFloatIsNotNan2(void)
|
|
772
|
+
{
|
|
773
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
774
|
+
TEST_IGNORE();
|
|
775
|
+
#else
|
|
776
|
+
TEST_ASSERT_FLOAT_IS_NOT_NAN(234.9f);
|
|
777
|
+
#endif
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
void testFloatInfIsNotNan(void)
|
|
781
|
+
{
|
|
782
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
783
|
+
TEST_IGNORE();
|
|
784
|
+
#else
|
|
785
|
+
EXPECT_ABORT_BEGIN
|
|
786
|
+
TEST_ASSERT_FLOAT_IS_NAN(1.0f / f_zero);
|
|
787
|
+
VERIFY_FAILS_END
|
|
788
|
+
#endif
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
void testFloatNanIsNotInf(void)
|
|
792
|
+
{
|
|
793
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
794
|
+
TEST_IGNORE();
|
|
795
|
+
#else
|
|
796
|
+
EXPECT_ABORT_BEGIN
|
|
797
|
+
TEST_ASSERT_FLOAT_IS_INF(0.0f / f_zero);
|
|
798
|
+
VERIFY_FAILS_END
|
|
799
|
+
#endif
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
void testFloatIsDeterminate1(void)
|
|
803
|
+
{
|
|
804
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
805
|
+
TEST_IGNORE();
|
|
806
|
+
#else
|
|
807
|
+
TEST_ASSERT_FLOAT_IS_DETERMINATE(0.0f);
|
|
808
|
+
TEST_ASSERT_FLOAT_IS_DETERMINATE(123.3f);
|
|
809
|
+
TEST_ASSERT_FLOAT_IS_DETERMINATE(-88.3f);
|
|
810
|
+
#endif
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
void testFloatIsDeterminate2(void)
|
|
814
|
+
{
|
|
815
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
816
|
+
TEST_IGNORE();
|
|
817
|
+
#else
|
|
818
|
+
EXPECT_ABORT_BEGIN
|
|
819
|
+
TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-88.3f);
|
|
820
|
+
VERIFY_FAILS_END
|
|
821
|
+
#endif
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
void testFloatIsNotDeterminate1(void)
|
|
825
|
+
{
|
|
826
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
827
|
+
TEST_IGNORE();
|
|
828
|
+
#else
|
|
829
|
+
TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(1.0f / f_zero);
|
|
830
|
+
TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-1.0f / f_zero);
|
|
831
|
+
TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(0.0f / f_zero);
|
|
832
|
+
#endif
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
void testFloatIsNotDeterminate2(void)
|
|
836
|
+
{
|
|
837
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
838
|
+
TEST_IGNORE();
|
|
839
|
+
#else
|
|
840
|
+
EXPECT_ABORT_BEGIN
|
|
841
|
+
TEST_ASSERT_FLOAT_IS_DETERMINATE(-1.0f / f_zero);
|
|
842
|
+
VERIFY_FAILS_END
|
|
843
|
+
#endif
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
void testFloatTraitFailsOnInvalidTrait(void)
|
|
847
|
+
{
|
|
848
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
849
|
+
TEST_IGNORE();
|
|
850
|
+
#else
|
|
851
|
+
EXPECT_ABORT_BEGIN
|
|
852
|
+
UnityAssertFloatSpecial(1.0f, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT);
|
|
853
|
+
VERIFY_FAILS_END
|
|
854
|
+
#endif
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
void testEqualFloatArrays(void)
|
|
858
|
+
{
|
|
859
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
860
|
+
TEST_IGNORE();
|
|
861
|
+
#else
|
|
862
|
+
float p0[] = {1.0f, -8.0f, 25.4f, -0.123f};
|
|
863
|
+
float p1[] = {1.0f, -8.0f, 25.4f, -0.123f};
|
|
864
|
+
float p2[] = {1.0f, -8.0f, 25.4f, -0.2f};
|
|
865
|
+
float p3[] = {1.0f, -23.0f, 25.0f, -0.26f};
|
|
866
|
+
|
|
867
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1);
|
|
868
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4);
|
|
869
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
870
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3);
|
|
871
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1);
|
|
872
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(NULL, NULL, 1);
|
|
873
|
+
#endif
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
void testNotEqualFloatArraysExpectedNull(void)
|
|
877
|
+
{
|
|
878
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
879
|
+
TEST_IGNORE();
|
|
880
|
+
#else
|
|
881
|
+
float* p0 = NULL;
|
|
882
|
+
float p1[] = {1.0f, 8.0f, 25.4f, 0.252f};
|
|
883
|
+
|
|
884
|
+
EXPECT_ABORT_BEGIN
|
|
885
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
886
|
+
VERIFY_FAILS_END
|
|
887
|
+
#endif
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
void testNotEqualFloatArraysActualNull(void)
|
|
891
|
+
{
|
|
892
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
893
|
+
TEST_IGNORE();
|
|
894
|
+
#else
|
|
895
|
+
float p0[] = {1.0f, 8.0f, 25.4f, 0.253f};
|
|
896
|
+
float* p1 = NULL;
|
|
897
|
+
|
|
898
|
+
EXPECT_ABORT_BEGIN
|
|
899
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
900
|
+
VERIFY_FAILS_END
|
|
901
|
+
#endif
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
void testNotEqualFloatArrays1(void)
|
|
905
|
+
{
|
|
906
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
907
|
+
TEST_IGNORE();
|
|
908
|
+
#else
|
|
909
|
+
float p0[] = {1.0f, 8.0f, 25.4f, 0.253f};
|
|
910
|
+
float p1[] = {1.0f, 8.0f, 25.4f, 0.252f};
|
|
911
|
+
|
|
912
|
+
EXPECT_ABORT_BEGIN
|
|
913
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
914
|
+
VERIFY_FAILS_END
|
|
915
|
+
#endif
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
void testNotEqualFloatArrays2(void)
|
|
919
|
+
{
|
|
920
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
921
|
+
TEST_IGNORE();
|
|
922
|
+
#else
|
|
923
|
+
float p0[] = {1.0f, 8.0f, 25.4f, 0.253f};
|
|
924
|
+
float p1[] = {2.0f, 8.0f, 25.4f, 0.253f};
|
|
925
|
+
|
|
926
|
+
EXPECT_ABORT_BEGIN
|
|
927
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
928
|
+
VERIFY_FAILS_END
|
|
929
|
+
#endif
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
void testNotEqualFloatArrays3(void)
|
|
933
|
+
{
|
|
934
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
935
|
+
TEST_IGNORE();
|
|
936
|
+
#else
|
|
937
|
+
float p0[] = {1.0f, 8.0f, 25.4f, 0.253f};
|
|
938
|
+
float p1[] = {1.0f, 8.0f, 25.5f, 0.253f};
|
|
939
|
+
|
|
940
|
+
EXPECT_ABORT_BEGIN
|
|
941
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
942
|
+
VERIFY_FAILS_END
|
|
943
|
+
#endif
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
void testNotEqualFloatArraysNegative1(void)
|
|
947
|
+
{
|
|
948
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
949
|
+
TEST_IGNORE();
|
|
950
|
+
#else
|
|
951
|
+
float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f};
|
|
952
|
+
float p1[] = {-1.0f, -8.0f, -25.4f, -0.252f};
|
|
953
|
+
|
|
954
|
+
EXPECT_ABORT_BEGIN
|
|
955
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
956
|
+
VERIFY_FAILS_END
|
|
957
|
+
#endif
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
void testNotEqualFloatArraysNegative2(void)
|
|
961
|
+
{
|
|
962
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
963
|
+
TEST_IGNORE();
|
|
964
|
+
#else
|
|
965
|
+
float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f};
|
|
966
|
+
float p1[] = {-2.0f, -8.0f, -25.4f, -0.253f};
|
|
967
|
+
|
|
968
|
+
EXPECT_ABORT_BEGIN
|
|
969
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
970
|
+
VERIFY_FAILS_END
|
|
971
|
+
#endif
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
void testNotEqualFloatArraysNegative3(void)
|
|
975
|
+
{
|
|
976
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
977
|
+
TEST_IGNORE();
|
|
978
|
+
#else
|
|
979
|
+
float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f};
|
|
980
|
+
float p1[] = {-1.0f, -8.0f, -25.5f, -0.253f};
|
|
981
|
+
|
|
982
|
+
EXPECT_ABORT_BEGIN
|
|
983
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
984
|
+
VERIFY_FAILS_END
|
|
985
|
+
#endif
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
void testEqualFloatArraysNaN(void)
|
|
989
|
+
{
|
|
990
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
991
|
+
TEST_IGNORE();
|
|
992
|
+
#else
|
|
993
|
+
float p0[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f};
|
|
994
|
+
float p1[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f};
|
|
995
|
+
|
|
996
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
997
|
+
#endif
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
void testEqualFloatArraysInf(void)
|
|
1001
|
+
{
|
|
1002
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1003
|
+
TEST_IGNORE();
|
|
1004
|
+
#else
|
|
1005
|
+
float p0[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f};
|
|
1006
|
+
float p1[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f};
|
|
1007
|
+
|
|
1008
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
|
|
1009
|
+
#endif
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
void testNotEqualFloatArraysLengthZero(void)
|
|
1013
|
+
{
|
|
1014
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1015
|
+
TEST_IGNORE();
|
|
1016
|
+
#else
|
|
1017
|
+
float p0[1] = {0.0f};
|
|
1018
|
+
float p1[1] = {0.0f};
|
|
1019
|
+
|
|
1020
|
+
EXPECT_ABORT_BEGIN
|
|
1021
|
+
TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 0);
|
|
1022
|
+
VERIFY_FAILS_END
|
|
1023
|
+
#endif
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
void testFloatArraysWithin(void)
|
|
1027
|
+
{
|
|
1028
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1029
|
+
TEST_IGNORE();
|
|
1030
|
+
#else
|
|
1031
|
+
float p0[] = {1.0f, -8.0f, 25.4f, -0.123f};
|
|
1032
|
+
float p1[] = {1.0f, -8.0f, 25.4f, -0.123f};
|
|
1033
|
+
float p2[] = {1.0f, -8.0f, 25.4f, -0.2f};
|
|
1034
|
+
float p3[] = {1.0f, -23.0f, 25.0f, -0.26f};
|
|
1035
|
+
float p4[] = {2.0f, -9.0f, 26.2f, 0.26f};
|
|
1036
|
+
float p5[] = {-1.0f, -7.0f, 29.0f, 2.6f};
|
|
1037
|
+
|
|
1038
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p0, 1);
|
|
1039
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p0, 4);
|
|
1040
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p1, 4);
|
|
1041
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p2, 3);
|
|
1042
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p3, 1);
|
|
1043
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p4, 1);
|
|
1044
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, p0, p4, 4);
|
|
1045
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(2.0f, p0, p5, 1);
|
|
1046
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(2.0f, p0, p5, 2);
|
|
1047
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(1.0f, NULL, NULL, 1);
|
|
1048
|
+
#endif
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
void testFloatArraysWithinUnusualDelta(void)
|
|
1052
|
+
{
|
|
1053
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1054
|
+
TEST_IGNORE();
|
|
1055
|
+
#else
|
|
1056
|
+
float p0[] = {(float)-INFINITY, -8.0f, 25.4f, -0.123f};
|
|
1057
|
+
float p1[] = {(float)INFINITY, 10.1f};
|
|
1058
|
+
|
|
1059
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(INFINITY, p0, p1, 2);
|
|
1060
|
+
|
|
1061
|
+
EXPECT_ABORT_BEGIN
|
|
1062
|
+
TEST_ASSERT_FLOAT_ARRAY_WITHIN(NAN, p0, p0, 4);
|
|
1063
|
+
VERIFY_FAILS_END
|
|
1064
|
+
#endif
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
void testEqualFloatEachEqual(void)
|
|
1068
|
+
{
|
|
1069
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1070
|
+
TEST_IGNORE();
|
|
1071
|
+
#else
|
|
1072
|
+
float p0[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
|
1073
|
+
float p1[] = {-0.123f, -0.123f, -0.123f, -0.123f};
|
|
1074
|
+
float p2[] = {25.4f, 25.4f, 25.4f, -0.2f};
|
|
1075
|
+
float p3[] = {1.0f, -23.0f, 25.0f, -0.26f};
|
|
1076
|
+
|
|
1077
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 1);
|
|
1078
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 4);
|
|
1079
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(-0.123f, p1, 4);
|
|
1080
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(25.4f, p2, 3);
|
|
1081
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p3, 1);
|
|
1082
|
+
#endif
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
void testNotEqualFloatEachEqualActualNull(void)
|
|
1086
|
+
{
|
|
1087
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1088
|
+
TEST_IGNORE();
|
|
1089
|
+
#else
|
|
1090
|
+
float* p0 = NULL;
|
|
1091
|
+
|
|
1092
|
+
EXPECT_ABORT_BEGIN
|
|
1093
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(5, p0, 4);
|
|
1094
|
+
VERIFY_FAILS_END
|
|
1095
|
+
#endif
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
void testNotEqualFloatEachEqual1(void)
|
|
1099
|
+
{
|
|
1100
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1101
|
+
TEST_IGNORE();
|
|
1102
|
+
#else
|
|
1103
|
+
float p0[] = {0.253f, 8.0f, 0.253f, 0.253f};
|
|
1104
|
+
|
|
1105
|
+
EXPECT_ABORT_BEGIN
|
|
1106
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(0.253f, p0, 4);
|
|
1107
|
+
VERIFY_FAILS_END
|
|
1108
|
+
#endif
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
void testNotEqualFloatEachEqual2(void)
|
|
1112
|
+
{
|
|
1113
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1114
|
+
TEST_IGNORE();
|
|
1115
|
+
#else
|
|
1116
|
+
float p0[] = {8.0f, 8.0f, 8.0f, 0.253f};
|
|
1117
|
+
|
|
1118
|
+
EXPECT_ABORT_BEGIN
|
|
1119
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(8.0f, p0, 4);
|
|
1120
|
+
VERIFY_FAILS_END
|
|
1121
|
+
#endif
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
void testNotEqualFloatEachEqual3(void)
|
|
1125
|
+
{
|
|
1126
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1127
|
+
TEST_IGNORE();
|
|
1128
|
+
#else
|
|
1129
|
+
float p0[] = {1.0f, 1.0f, 1.0f, 0.253f};
|
|
1130
|
+
|
|
1131
|
+
EXPECT_ABORT_BEGIN
|
|
1132
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 4);
|
|
1133
|
+
VERIFY_FAILS_END
|
|
1134
|
+
#endif
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
void testNotEqualFloatEachEqualNegative1(void)
|
|
1138
|
+
{
|
|
1139
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1140
|
+
TEST_IGNORE();
|
|
1141
|
+
#else
|
|
1142
|
+
float p0[] = {-1.0f, -0.253f, -0.253f, -0.253f};
|
|
1143
|
+
|
|
1144
|
+
EXPECT_ABORT_BEGIN
|
|
1145
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(-0.253f, p0, 4);
|
|
1146
|
+
VERIFY_FAILS_END
|
|
1147
|
+
#endif
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
void testNotEqualFloatEachEqualNegative2(void)
|
|
1151
|
+
{
|
|
1152
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1153
|
+
TEST_IGNORE();
|
|
1154
|
+
#else
|
|
1155
|
+
float p0[] = {-25.4f, -8.0f, -25.4f, -25.4f};
|
|
1156
|
+
|
|
1157
|
+
EXPECT_ABORT_BEGIN
|
|
1158
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(-25.4f, p0, 4);
|
|
1159
|
+
VERIFY_FAILS_END
|
|
1160
|
+
#endif
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
void testNotEqualFloatEachEqualNegative3(void)
|
|
1164
|
+
{
|
|
1165
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1166
|
+
TEST_IGNORE();
|
|
1167
|
+
#else
|
|
1168
|
+
float p0[] = {-8.0f, -8.0f, -8.0f, -0.253f};
|
|
1169
|
+
|
|
1170
|
+
EXPECT_ABORT_BEGIN
|
|
1171
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(-8.0f, p0, 4);
|
|
1172
|
+
VERIFY_FAILS_END
|
|
1173
|
+
#endif
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
void testEqualFloatEachEqualNaN(void)
|
|
1177
|
+
{
|
|
1178
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1179
|
+
TEST_IGNORE();
|
|
1180
|
+
#else
|
|
1181
|
+
float p0[] = {0.0f / f_zero, 0.0f / f_zero, 0.0f / f_zero, 0.0f / f_zero};
|
|
1182
|
+
|
|
1183
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(0.0f / f_zero, p0, 4);
|
|
1184
|
+
#endif
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
void testEqualFloatEachEqualInf(void)
|
|
1188
|
+
{
|
|
1189
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1190
|
+
TEST_IGNORE();
|
|
1191
|
+
#else
|
|
1192
|
+
float p0[] = {1.0f / f_zero, 1.0f / f_zero, 25.4f, 0.253f};
|
|
1193
|
+
|
|
1194
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f / f_zero, p0, 2);
|
|
1195
|
+
#endif
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
void testNotEqualFloatEachEqualLengthZero(void)
|
|
1199
|
+
{
|
|
1200
|
+
#ifdef UNITY_EXCLUDE_FLOAT
|
|
1201
|
+
TEST_IGNORE();
|
|
1202
|
+
#else
|
|
1203
|
+
float p0[1] = {0.0f};
|
|
1204
|
+
|
|
1205
|
+
EXPECT_ABORT_BEGIN
|
|
1206
|
+
TEST_ASSERT_EACH_EQUAL_FLOAT(0.0f, p0, 0);
|
|
1207
|
+
VERIFY_FAILS_END
|
|
1208
|
+
#endif
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
void testFloatPrinting(void)
|
|
1212
|
+
{
|
|
1213
|
+
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
|
|
1214
|
+
TEST_IGNORE();
|
|
1215
|
+
#else
|
|
1216
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("0", 0.0f);
|
|
1217
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("4.99e-07", 0.000000499f);
|
|
1218
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("0.1004695", 0.100469499f);
|
|
1219
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("2", 1.9999995f); /*Rounding to int place*/
|
|
1220
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1", 1.0f);
|
|
1221
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.25", 1.25f);
|
|
1222
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("7.999999", 7.999999f); /*Not rounding*/
|
|
1223
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("16.00002", 16.00002f);
|
|
1224
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("16.00004", 16.00004f);
|
|
1225
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("16.00006", 16.00006f);
|
|
1226
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("9999999", 9999999.0f); /*Last full print integer*/
|
|
1227
|
+
|
|
1228
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-0", -0.0f);
|
|
1229
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.99e-07", -0.000000499f);
|
|
1230
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-0.1004695", -0.100469499f);
|
|
1231
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-2", -1.9999995f); /*Rounding to int place*/
|
|
1232
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-1", -1.0f);
|
|
1233
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-1.25", -1.25f);
|
|
1234
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-7.999999", -7.999999f); /*Not rounding*/
|
|
1235
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.00002", -16.00002f);
|
|
1236
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.00004", -16.00004f);
|
|
1237
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.00006", -16.00006f);
|
|
1238
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-9999999", -9999999.0f); /*Last full print integer*/
|
|
1239
|
+
|
|
1240
|
+
/* Fails, prints "4.294968e+09" due to FP math imprecision
|
|
1241
|
+
* TEST_ASSERT_EQUAL_PRINT_FLOATING("4.294967e+09", 4294967296.0f); */
|
|
1242
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("5e+09", 5000000000.0f);
|
|
1243
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("8e+09", 8.0e+09f);
|
|
1244
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("8.309999e+09", 8309999104.0f);
|
|
1245
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 1.0e+10f);
|
|
1246
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 10000000000.0f);
|
|
1247
|
+
/* Some compilers have trouble with inexact float constants, a float cast works generally */
|
|
1248
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.000055e+10", (float)1.000055e+10f);
|
|
1249
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.1e+38", (float)1.10000005e+38f);
|
|
1250
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.635299e+10", 1.63529943e+10f);
|
|
1251
|
+
/* Fails, prints "3.402824e+38" due to FP math imprecision
|
|
1252
|
+
* TEST_ASSERT_EQUAL_PRINT_FLOATING("3.402823e+38", 3.40282346638e38f); */
|
|
1253
|
+
|
|
1254
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-1e+10", -1.0e+10f);
|
|
1255
|
+
/* Fails, prints "-3.402824e+38" due to FP math imprecision
|
|
1256
|
+
* TEST_ASSERT_EQUAL_PRINT_FLOATING("-3.402823e+38", -3.40282346638e38f); */
|
|
1257
|
+
#endif
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
void testFloatPrintingRoundTiesToEven(void)
|
|
1261
|
+
{
|
|
1262
|
+
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
|
|
1263
|
+
TEST_IGNORE();
|
|
1264
|
+
#else
|
|
1265
|
+
#ifdef UNITY_ROUND_TIES_AWAY_FROM_ZERO
|
|
1266
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("0.0004882813", 0.00048828125f);
|
|
1267
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("488281.3", 488281.25f);
|
|
1268
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("5.000001e-07", 0.00000050000005f);
|
|
1269
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-5.000001e-07", -0.00000050000005f);
|
|
1270
|
+
#else /* Default to Round ties to even */
|
|
1271
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("0.0004882812", 0.00048828125f);
|
|
1272
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("488281.2", 488281.25f);
|
|
1273
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("5e-07", 0.00000050000005f);
|
|
1274
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-5e-07", -0.00000050000005f);
|
|
1275
|
+
#endif
|
|
1276
|
+
#endif
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
void testFloatPrintingInfinityAndNaN(void)
|
|
1280
|
+
{
|
|
1281
|
+
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || !defined(USING_OUTPUT_SPY)
|
|
1282
|
+
TEST_IGNORE();
|
|
1283
|
+
#else
|
|
1284
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("inf", 1.0f / f_zero);
|
|
1285
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("-inf", -1.0f / f_zero);
|
|
1286
|
+
|
|
1287
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING("nan", 0.0f / f_zero);
|
|
1288
|
+
#endif
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
#if defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) && defined(USING_OUTPUT_SPY)
|
|
1292
|
+
#ifdef UNITY_INCLUDE_DOUBLE
|
|
1293
|
+
static void printFloatValue(float f)
|
|
1294
|
+
{
|
|
1295
|
+
char expected[18];
|
|
1296
|
+
|
|
1297
|
+
startPutcharSpy();
|
|
1298
|
+
UnityPrintFloat(f);
|
|
1299
|
+
|
|
1300
|
+
sprintf(expected, "%.9g", f);
|
|
1301
|
+
/* We print all NaN's as "nan", not "-nan" */
|
|
1302
|
+
if (strcmp(expected, "-nan") == 0) strcpy(expected, "nan");
|
|
1303
|
+
|
|
1304
|
+
if (strcmp(expected, getBufferPutcharSpy()))
|
|
1305
|
+
{
|
|
1306
|
+
/* Fail with diagnostic printing */
|
|
1307
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, f);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
#else
|
|
1311
|
+
static void printFloatValue(float f)
|
|
1312
|
+
{
|
|
1313
|
+
char expected[18];
|
|
1314
|
+
char expected_lower[18];
|
|
1315
|
+
char expected_lower2[18];
|
|
1316
|
+
char expected_lower3[18];
|
|
1317
|
+
char expected_higher[18];
|
|
1318
|
+
char expected_higher2[18];
|
|
1319
|
+
char expected_higher3[18];
|
|
1320
|
+
|
|
1321
|
+
startPutcharSpy();
|
|
1322
|
+
UnityPrintFloat(f);
|
|
1323
|
+
|
|
1324
|
+
sprintf(expected, "%.7g", f);
|
|
1325
|
+
/* We print all NaN's as "nan", not "-nan" */
|
|
1326
|
+
if (strcmp(expected, "-nan") == 0) strcpy(expected, "nan");
|
|
1327
|
+
|
|
1328
|
+
strcpy(expected_lower, expected);
|
|
1329
|
+
strcpy(expected_lower2, expected);
|
|
1330
|
+
strcpy(expected_lower3, expected);
|
|
1331
|
+
strcpy(expected_higher, expected);
|
|
1332
|
+
strcpy(expected_higher2, expected);
|
|
1333
|
+
strcpy(expected_higher3, expected);
|
|
1334
|
+
|
|
1335
|
+
/* Allow for rounding differences in the last digit */
|
|
1336
|
+
double lower = (double)f * 0.99999995;
|
|
1337
|
+
double higher = (double)f * 1.00000005;
|
|
1338
|
+
|
|
1339
|
+
if(isfinite(lower)) sprintf(expected_lower, "%.7g", lower);
|
|
1340
|
+
if(isfinite(higher)) sprintf(expected_higher, "%.7g", higher);
|
|
1341
|
+
|
|
1342
|
+
/* Outside [1,10000000] allow for relative error of +/-2.5e-7 */
|
|
1343
|
+
if (f < 1.0 || f > 10000000)
|
|
1344
|
+
{
|
|
1345
|
+
double lower2 = (double)f * 0.99999985;
|
|
1346
|
+
double lower3 = (double)f * 0.99999975;
|
|
1347
|
+
double higher2 = (double)f * 1.00000015;
|
|
1348
|
+
double higher3 = (double)f * 1.00000025;
|
|
1349
|
+
|
|
1350
|
+
if (isfinite(lower2)) sprintf(expected_lower2, "%.7g", lower2);
|
|
1351
|
+
if (isfinite(lower3)) sprintf(expected_lower3, "%.7g", lower3);
|
|
1352
|
+
if (isfinite(higher2)) sprintf(expected_higher2, "%.7g", higher2);
|
|
1353
|
+
if (isfinite(higher3)) sprintf(expected_higher3, "%.7g", higher3);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
if (strcmp(expected, getBufferPutcharSpy()) != 0 &&
|
|
1357
|
+
strcmp(expected_lower, getBufferPutcharSpy()) != 0 &&
|
|
1358
|
+
strcmp(expected_lower2, getBufferPutcharSpy()) != 0 &&
|
|
1359
|
+
strcmp(expected_lower3, getBufferPutcharSpy()) != 0 &&
|
|
1360
|
+
strcmp(expected_higher, getBufferPutcharSpy()) != 0 &&
|
|
1361
|
+
strcmp(expected_higher2, getBufferPutcharSpy()) != 0 &&
|
|
1362
|
+
strcmp(expected_higher3, getBufferPutcharSpy()) != 0)
|
|
1363
|
+
{
|
|
1364
|
+
/* Fail with diagnostic printing */
|
|
1365
|
+
TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, f);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
#endif
|
|
1369
|
+
#endif
|
|
1370
|
+
|
|
1371
|
+
void testFloatPrintingRandomSamples(void)
|
|
1372
|
+
{
|
|
1373
|
+
#if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY)
|
|
1374
|
+
TEST_IGNORE();
|
|
1375
|
+
#else
|
|
1376
|
+
union { float f_value; uint32_t int_value; } u;
|
|
1377
|
+
|
|
1378
|
+
/* These values are not covered by the MINSTD generator */
|
|
1379
|
+
u.int_value = 0x00000000; printFloatValue(u.f_value);
|
|
1380
|
+
u.int_value = 0x80000000; printFloatValue(u.f_value);
|
|
1381
|
+
u.int_value = 0x7fffffff; printFloatValue(u.f_value);
|
|
1382
|
+
u.int_value = 0xffffffff; printFloatValue(u.f_value);
|
|
1383
|
+
|
|
1384
|
+
uint32_t a = 1;
|
|
1385
|
+
for(int num_tested = 0; num_tested < 1000000; num_tested++)
|
|
1386
|
+
{
|
|
1387
|
+
/* MINSTD pseudo-random number generator */
|
|
1388
|
+
a = (uint32_t)(((uint64_t)a * 48271u) % 2147483647u);
|
|
1389
|
+
|
|
1390
|
+
/* MINSTD does not set the highest bit; test both possibilities */
|
|
1391
|
+
u.int_value = a; printFloatValue(u.f_value);
|
|
1392
|
+
u.int_value = a | 0x80000000; printFloatValue(u.f_value);
|
|
1393
|
+
}
|
|
1394
|
+
#endif
|
|
1395
|
+
}
|