edhoc 1.0.4 → 1.1.0
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/bindings.d.ts +5 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +10 -0
- package/dist/crypto.d.ts +29 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +205 -0
- package/dist/edhoc.d.ts +368 -0
- package/dist/edhoc.d.ts.map +1 -0
- package/dist/edhoc.js +76 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- 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/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,82 @@
|
|
|
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 testEqualMemory(void)
|
|
38
|
+
{
|
|
39
|
+
const char *testString = "whatever";
|
|
40
|
+
|
|
41
|
+
TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8);
|
|
42
|
+
TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8);
|
|
43
|
+
TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8);
|
|
44
|
+
TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8);
|
|
45
|
+
TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2);
|
|
46
|
+
TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void testNotEqualMemory1(void)
|
|
50
|
+
{
|
|
51
|
+
EXPECT_ABORT_BEGIN
|
|
52
|
+
TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3);
|
|
53
|
+
VERIFY_FAILS_END
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void testNotEqualMemory2(void)
|
|
57
|
+
{
|
|
58
|
+
EXPECT_ABORT_BEGIN
|
|
59
|
+
TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4);
|
|
60
|
+
VERIFY_FAILS_END
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void testNotEqualMemory3(void)
|
|
64
|
+
{
|
|
65
|
+
EXPECT_ABORT_BEGIN
|
|
66
|
+
TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4);
|
|
67
|
+
VERIFY_FAILS_END
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void testNotEqualMemory4(void)
|
|
71
|
+
{
|
|
72
|
+
EXPECT_ABORT_BEGIN
|
|
73
|
+
TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4);
|
|
74
|
+
VERIFY_FAILS_END
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void testNotEqualMemoryLengthZero(void)
|
|
78
|
+
{
|
|
79
|
+
EXPECT_ABORT_BEGIN
|
|
80
|
+
TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 0);
|
|
81
|
+
VERIFY_FAILS_END
|
|
82
|
+
}
|
|
@@ -0,0 +1,309 @@
|
|
|
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 <setjmp.h>
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
#include "unity.h"
|
|
11
|
+
#include "types_for_test.h"
|
|
12
|
+
|
|
13
|
+
/* Include Passthroughs for Linking Tests */
|
|
14
|
+
void putcharSpy(int c) { (void)putchar(c);}
|
|
15
|
+
void flushSpy(void) {}
|
|
16
|
+
|
|
17
|
+
#define EXPECT_ABORT_BEGIN \
|
|
18
|
+
if (TEST_PROTECT()) \
|
|
19
|
+
{
|
|
20
|
+
|
|
21
|
+
#define VERIFY_FAILS_END \
|
|
22
|
+
} \
|
|
23
|
+
Unity.CurrentTestFailed = (Unity.CurrentTestFailed != 0) ? 0 : 1; \
|
|
24
|
+
if (Unity.CurrentTestFailed == 1) { \
|
|
25
|
+
SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
|
|
26
|
+
UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
|
|
27
|
+
UNITY_OUTPUT_CHAR(':'); \
|
|
28
|
+
UnityPrint(Unity.CurrentTestName); \
|
|
29
|
+
UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \
|
|
30
|
+
UNITY_OUTPUT_CHAR('\n'); \
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#define VERIFY_IGNORES_END \
|
|
34
|
+
} \
|
|
35
|
+
Unity.CurrentTestFailed = (Unity.CurrentTestIgnored != 0) ? 0 : 1; \
|
|
36
|
+
Unity.CurrentTestIgnored = 0; \
|
|
37
|
+
if (Unity.CurrentTestFailed == 1) { \
|
|
38
|
+
SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
|
|
39
|
+
UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
|
|
40
|
+
UNITY_OUTPUT_CHAR(':'); \
|
|
41
|
+
UnityPrint(Unity.CurrentTestName); \
|
|
42
|
+
UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \
|
|
43
|
+
UNITY_OUTPUT_CHAR('\n'); \
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static int SetToOneToFailInTearDown;
|
|
47
|
+
static int SetToOneMeanWeAlreadyCheckedThisGuy;
|
|
48
|
+
static unsigned NextExpectedStringIndex;
|
|
49
|
+
static unsigned NextExpectedCharIndex;
|
|
50
|
+
static unsigned NextExpectedSpaceIndex;
|
|
51
|
+
|
|
52
|
+
void suiteSetUp(void)
|
|
53
|
+
{
|
|
54
|
+
NextExpectedStringIndex = 0;
|
|
55
|
+
NextExpectedCharIndex = 0;
|
|
56
|
+
NextExpectedSpaceIndex = 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void setUp(void)
|
|
60
|
+
{
|
|
61
|
+
SetToOneToFailInTearDown = 0;
|
|
62
|
+
SetToOneMeanWeAlreadyCheckedThisGuy = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
void tearDown(void)
|
|
66
|
+
{
|
|
67
|
+
if (SetToOneToFailInTearDown == 1)
|
|
68
|
+
TEST_FAIL_MESSAGE("<= Failed in tearDown");
|
|
69
|
+
if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
|
|
70
|
+
{
|
|
71
|
+
UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
|
|
72
|
+
UNITY_OUTPUT_CHAR('\n');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
TEST_CASE(0)
|
|
77
|
+
TEST_CASE(44)
|
|
78
|
+
TEST_CASE((90)+9)
|
|
79
|
+
void test_TheseShouldAllPass(int Num)
|
|
80
|
+
{
|
|
81
|
+
TEST_ASSERT_TRUE(Num < 100);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
TEST_CASE(3)
|
|
85
|
+
TEST_CASE(77)
|
|
86
|
+
TEST_CASE( (99) + 1 - (1))
|
|
87
|
+
void test_TheseShouldAllFail(int Num)
|
|
88
|
+
{
|
|
89
|
+
EXPECT_ABORT_BEGIN
|
|
90
|
+
TEST_ASSERT_TRUE(Num > 100);
|
|
91
|
+
VERIFY_FAILS_END
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
TEST_CASE(1)
|
|
95
|
+
TEST_CASE(44)
|
|
96
|
+
TEST_CASE(99)
|
|
97
|
+
TEST_CASE(98)
|
|
98
|
+
void test_TheseAreEveryOther(int Num)
|
|
99
|
+
{
|
|
100
|
+
if (Num & 1)
|
|
101
|
+
{
|
|
102
|
+
EXPECT_ABORT_BEGIN
|
|
103
|
+
TEST_ASSERT_TRUE(Num > 100);
|
|
104
|
+
VERIFY_FAILS_END
|
|
105
|
+
}
|
|
106
|
+
else
|
|
107
|
+
{
|
|
108
|
+
TEST_ASSERT_TRUE(Num < 100);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void test_NormalPassesStillWork(void)
|
|
113
|
+
{
|
|
114
|
+
TEST_ASSERT_TRUE(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void test_NormalFailsStillWork(void)
|
|
118
|
+
{
|
|
119
|
+
EXPECT_ABORT_BEGIN
|
|
120
|
+
TEST_ASSERT_TRUE(0);
|
|
121
|
+
VERIFY_FAILS_END
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
TEST_CASE(0, "abc")
|
|
125
|
+
TEST_CASE(1, "{")
|
|
126
|
+
TEST_CASE(2, "}")
|
|
127
|
+
TEST_CASE(3, ";")
|
|
128
|
+
TEST_CASE(4, "\"quoted\"")
|
|
129
|
+
void test_StringsArePreserved(unsigned index, const char * str)
|
|
130
|
+
{
|
|
131
|
+
static const char * const expected[] =
|
|
132
|
+
{
|
|
133
|
+
"abc",
|
|
134
|
+
"{",
|
|
135
|
+
"}",
|
|
136
|
+
";",
|
|
137
|
+
"\"quoted\""
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/* Ensure that no test cases are skipped by tracking the next expected index */
|
|
141
|
+
TEST_ASSERT_EQUAL_UINT32(NextExpectedStringIndex, index);
|
|
142
|
+
TEST_ASSERT_LESS_THAN(sizeof(expected) / sizeof(expected[0]), index);
|
|
143
|
+
TEST_ASSERT_EQUAL_STRING(expected[index], str);
|
|
144
|
+
|
|
145
|
+
NextExpectedStringIndex++;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
TEST_CASE(0, 'x')
|
|
149
|
+
TEST_CASE(1, '{')
|
|
150
|
+
TEST_CASE(2, '}')
|
|
151
|
+
TEST_CASE(3, ';')
|
|
152
|
+
TEST_CASE(4, '\'')
|
|
153
|
+
TEST_CASE(5, '"')
|
|
154
|
+
void test_CharsArePreserved(unsigned index, char c)
|
|
155
|
+
{
|
|
156
|
+
static const char expected[] =
|
|
157
|
+
{
|
|
158
|
+
'x',
|
|
159
|
+
'{',
|
|
160
|
+
'}',
|
|
161
|
+
';',
|
|
162
|
+
'\'',
|
|
163
|
+
'"'
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/* Ensure that no test cases are skipped by tracking the next expected index */
|
|
167
|
+
TEST_ASSERT_EQUAL_UINT32(NextExpectedCharIndex, index);
|
|
168
|
+
TEST_ASSERT_LESS_THAN(sizeof(expected) / sizeof(expected[0]), index);
|
|
169
|
+
TEST_ASSERT_EQUAL(expected[index], c);
|
|
170
|
+
|
|
171
|
+
NextExpectedCharIndex++;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
TEST_RANGE([0, 10, 2])
|
|
175
|
+
void test_SingleRange(unsigned value)
|
|
176
|
+
{
|
|
177
|
+
TEST_ASSERT_EQUAL(0, value % 2);
|
|
178
|
+
TEST_ASSERT_LESS_OR_EQUAL(10, value);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
TEST_RANGE([1, 2, 1], [2, 1, -1])
|
|
182
|
+
void test_TwoRanges(unsigned first, unsigned second)
|
|
183
|
+
{
|
|
184
|
+
TEST_ASSERT_LESS_OR_EQUAL(4, first * second);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
TEST_RANGE(<0, 10, 2>)
|
|
188
|
+
void test_SingleExclusiveRange(unsigned value)
|
|
189
|
+
{
|
|
190
|
+
TEST_ASSERT_EQUAL(0, value % 2);
|
|
191
|
+
TEST_ASSERT_LESS_THAN(10, value);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
TEST_RANGE([2, 4, 1], <1, 2, 1>)
|
|
195
|
+
void test_BothInclusiveAndExclusiveRange(unsigned first, unsigned second)
|
|
196
|
+
{
|
|
197
|
+
TEST_ASSERT_LESS_THAN(first, second);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
TEST_CASE(0,
|
|
201
|
+
|
|
202
|
+
1)
|
|
203
|
+
TEST_CASE(1,
|
|
204
|
+
|
|
205
|
+
2
|
|
206
|
+
|
|
207
|
+
)
|
|
208
|
+
TEST_RANGE([2,
|
|
209
|
+
5 ,
|
|
210
|
+
1], [6, 6, 1])
|
|
211
|
+
TEST_CASE(
|
|
212
|
+
|
|
213
|
+
6 , 7)
|
|
214
|
+
TEST_MATRIX([7,
|
|
215
|
+
8 ,
|
|
216
|
+
|
|
217
|
+
9, 10],
|
|
218
|
+
[
|
|
219
|
+
11]
|
|
220
|
+
|
|
221
|
+
)
|
|
222
|
+
void test_SpaceInTestCase(unsigned index, unsigned bigger)
|
|
223
|
+
{
|
|
224
|
+
TEST_ASSERT_EQUAL_UINT32(NextExpectedSpaceIndex, index);
|
|
225
|
+
TEST_ASSERT_LESS_THAN(bigger, index);
|
|
226
|
+
|
|
227
|
+
NextExpectedSpaceIndex++;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
TEST_MATRIX([1, 5, (2*2)+1, 4])
|
|
231
|
+
void test_SingleMatix(unsigned value)
|
|
232
|
+
{
|
|
233
|
+
TEST_ASSERT_LESS_OR_EQUAL(10, value);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
TEST_MATRIX([2, 5l, 4u+3, 4ul], [-2, 3])
|
|
237
|
+
void test_TwoMatrices(unsigned first, signed second)
|
|
238
|
+
{
|
|
239
|
+
static unsigned idx = 0;
|
|
240
|
+
static const unsigned expected[] =
|
|
241
|
+
{
|
|
242
|
+
// -2 3
|
|
243
|
+
-4, 6, // 2
|
|
244
|
+
-10, 15, // 5
|
|
245
|
+
-14, 21, // 7
|
|
246
|
+
-8, 12, // 4
|
|
247
|
+
};
|
|
248
|
+
TEST_ASSERT_EQUAL_INT(expected[idx++], first * second);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
TEST_MATRIX(["String1", "String,2", "Stri" "ng3", "String[4]", "String\"5\""], [-5, 12.5f])
|
|
252
|
+
void test_StringsAndNumbersMatrices(const char* str, float number)
|
|
253
|
+
{
|
|
254
|
+
static unsigned idx = 0;
|
|
255
|
+
static const char* expected[] =
|
|
256
|
+
{
|
|
257
|
+
"String1_-05.00",
|
|
258
|
+
"String1_+12.50",
|
|
259
|
+
"String,2_-05.00",
|
|
260
|
+
"String,2_+12.50",
|
|
261
|
+
"String3_-05.00",
|
|
262
|
+
"String3_+12.50",
|
|
263
|
+
"String[4]_-05.00",
|
|
264
|
+
"String[4]_+12.50",
|
|
265
|
+
"String\"5\"_-05.00",
|
|
266
|
+
"String\"5\"_+12.50",
|
|
267
|
+
};
|
|
268
|
+
char buf[200] = {0};
|
|
269
|
+
snprintf(buf, sizeof(buf), "%s_%+06.2f", str, number);
|
|
270
|
+
TEST_ASSERT_EQUAL_STRING(expected[idx++], buf);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
TEST_MATRIX(
|
|
274
|
+
[ENUM_A, ENUM_4, ENUM_C],
|
|
275
|
+
[test_arr[0], 7.8f, test_arr[2]],
|
|
276
|
+
['a', 'f', '[', ']', '\'', '"'],
|
|
277
|
+
)
|
|
278
|
+
void test_EnumCharAndArrayMatrices(test_enum_t e, float n, char c)
|
|
279
|
+
{
|
|
280
|
+
static unsigned enum_idx = 0;
|
|
281
|
+
static const test_enum_t exp_enum[3] = {
|
|
282
|
+
ENUM_A, ENUM_4, ENUM_C,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
static unsigned float_idx = 0;
|
|
286
|
+
float exp_float[3] = {0};
|
|
287
|
+
exp_float[0] = test_arr[0];
|
|
288
|
+
exp_float[1] = 7.8f;
|
|
289
|
+
exp_float[2] = test_arr[2];
|
|
290
|
+
|
|
291
|
+
static unsigned char_idx = 0;
|
|
292
|
+
static const test_enum_t exp_char[] = {
|
|
293
|
+
'a', 'f', '[', ']', '\'', '"'
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
TEST_ASSERT_EQUAL_INT(exp_enum[enum_idx], e);
|
|
297
|
+
TEST_ASSERT_EQUAL_FLOAT(exp_float[float_idx], n);
|
|
298
|
+
TEST_ASSERT_EQUAL_CHAR(exp_char[char_idx], c);
|
|
299
|
+
|
|
300
|
+
char_idx = (char_idx + 1) % 6;
|
|
301
|
+
if (char_idx == 0.0f)
|
|
302
|
+
{
|
|
303
|
+
float_idx = (float_idx + 1) % 3;
|
|
304
|
+
if (float_idx == 0.0f)
|
|
305
|
+
{
|
|
306
|
+
enum_idx = (enum_idx + 1) % 3;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
|
|
10
|
+
/* Support for Meta Test Rig */
|
|
11
|
+
#ifndef TEST_CASE
|
|
12
|
+
#define TEST_CASE(...)
|
|
13
|
+
#endif
|
|
14
|
+
#ifndef TEST_RANGE
|
|
15
|
+
#define TEST_RANGE(...)
|
|
16
|
+
#endif
|
|
17
|
+
#ifndef TEST_MATRIX
|
|
18
|
+
#define TEST_MATRIX(...)
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
TEST_CASE(1, 2, 5)
|
|
22
|
+
TEST_CASE(10, 7, 20)
|
|
23
|
+
TEST_RANGE([3, 4, 1], [10, 5, -2], <30, 31, 1>)
|
|
24
|
+
TEST_MATRIX([3, 4, 7], [10, 8, 2, 1],[30u, 20.0f])
|
|
25
|
+
void test_demoParamFunction(int a, int b, int c)
|
|
26
|
+
{
|
|
27
|
+
TEST_ASSERT_GREATER_THAN_INT(a + b, c);
|
|
28
|
+
}
|