diff options
author | michele papalini <micpapal+fdio@cisco.com> | 2017-05-12 11:23:06 +0200 |
---|---|---|
committer | michele papalini <micpapal+fdio@cisco.com> | 2017-05-12 11:31:31 +0200 |
commit | 5e7ad51c32a92b84e2e42741d96c68ec834e6f8b (patch) | |
tree | c003ad86d3f587fda25a5adc3079f5b716821320 | |
parent | 524fbbe857d5f9f07905b09d7a87eb4c834cf3b2 (diff) |
new tests
Change-Id: I76790b0963ac2b477bf0b707224bd8380b231c0c
Signed-off-by: michele papalini <micpapal+fdio@cisco.com>
12 files changed, 39 insertions, 35 deletions
diff --git a/libccnx-common/ccnx/common/CMakeLists.txt b/libccnx-common/ccnx/common/CMakeLists.txt index 66d82a44..81a7054e 100644 --- a/libccnx-common/ccnx/common/CMakeLists.txt +++ b/libccnx-common/ccnx/common/CMakeLists.txt @@ -265,8 +265,8 @@ install(FILES ${TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/inc install(FILES ${SCHEMAV1_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1 COMPONENT headers) install(FILES ${SCHEMAV1_TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1/testdata COMPONENT headers) -#add_subdirectory(test) -#add_subdirectory(validation/test) -#add_subdirectory(codec/test) -#add_subdirectory(internal/test) -#add_subdirectory(codec/schema_v1/test) +add_subdirectory(test) +add_subdirectory(validation/test) +add_subdirectory(codec/test) +add_subdirectory(internal/test) +add_subdirectory(codec/schema_v1/test) diff --git a/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_OptionalHeadersDecoder.c b/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_OptionalHeadersDecoder.c index abe47608..0f4097b8 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_OptionalHeadersDecoder.c +++ b/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_OptionalHeadersDecoder.c @@ -61,13 +61,13 @@ static uint8_t packet_with_headers[] = { 0x61, 0x71, 0x81, 0x91, // ------------------------ // byte 32 - 0x00, 0x03, 0x00, 0x0C, // Interest Fragment (type 3) + 0x00, 0x04, 0x00, 0x0C, // Interest Fragment (type 4) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // fragment 0x0102030405060708 0x05, 0xDC, 0x04, 0x00, // MTU 1500, fragcnt 4, fragnum 0 // ------------------------ // byte 48 - 0x00, 0x04, 0x00, 20, // ContentObject Fragment (type 4) + 0x00, 0x05, 0x00, 20, // ContentObject Fragment (type 5) 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, // fragment 0xC1C2C3C4C5C6C7C8 0x05, 0xDC, 0x04, 0x00, // MTU 1500, fragcnt 4, fragnum 0 diff --git a/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_PacketEncoder.c b/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_PacketEncoder.c index eb79502e..799d106e 100755 --- a/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_PacketEncoder.c +++ b/libccnx-common/ccnx/common/codec/schema_v1/test/test_ccnxCodecSchemaV1_PacketEncoder.c @@ -256,7 +256,7 @@ LONGBOW_TEST_CASE(ContentObject, no_cryptosuite) assertNotNull(encoded, "got null output buffer"); // it should be 33 bytes without a signature - assertTrue(parcBuffer_Remaining(encoded) == 33, "Wrong length exepcted 33 got %zu", parcBuffer_Remaining(encoded)); + assertTrue(parcBuffer_Remaining(encoded) == 38, "Wrong length exepcted 38 got %zu", parcBuffer_Remaining(encoded)); parcBuffer_Release(&encoded); ccnxCodecTlvEncoder_Destroy(&encoder); diff --git a/libccnx-common/ccnx/common/codec/schema_v1/test/testrig_packetwrapper.c b/libccnx-common/ccnx/common/codec/schema_v1/test/testrig_packetwrapper.c index 9a213b13..7416cf28 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/test/testrig_packetwrapper.c +++ b/libccnx-common/ccnx/common/codec/schema_v1/test/testrig_packetwrapper.c @@ -381,6 +381,7 @@ testBufferGetter(TestData *data, int truthTableKey, bool containerDecoder(CCNxCo PARCBuffer *test = getter(data->dictionary); // look up the true name buffer from the truth table + printf("table key = %d\n", truthTableKey); TlvExtent extent = getTruthTableExtent(data->truthTable, truthTableKey); PARCBuffer *truth = parcBuffer_Wrap(data->packet, data->packetLength, extent.offset, extent.offset + extent.length); diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_crc32c.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_crc32c.h index e4695849..af559495 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_crc32c.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_crc32c.h @@ -65,7 +65,7 @@ static uint8_t v1_content_nameA_crc32c[] = { 0x01, 0x01, 0x00, 85, // ver = 1, type = content object, length = 85 0x00, 0x00, 0x00, 44, // HopLimit = 31, reserved = 0, header length = 44 // ------------------------ - 0x00, 0x04, 0x00, 20, // ContentObject Fragment, length = 20 + 0x00, 0x05, 0x00, 20, // ContentObject Fragment, length = 20 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, // fragid 0x1223344556677889 0x05, 0xDC, 0x01, 0x00, // MTU 1500, fragcnt 1, fragnum 0 diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_keyid1_rsasha256.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_keyid1_rsasha256.h index ef37fb5e..01ee2cf6 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_keyid1_rsasha256.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameA_keyid1_rsasha256.h @@ -84,15 +84,18 @@ __attribute__((unused)) static uint8_t v1_content_nameA_keyid1_rsasha256[] = { - 0x01, 0x01, 0x01, 0xB4,// ver = 1, type = content object, length = 436 - 0x00, 0x00, 0x00, 32, // HopLimit = 0, reserved = 0, header length = 32 + 0x01, 0x01, 0x01, 0xB9,// ver = 1, type = content object, length = 441 + 0x00, 0x00, 0x00, 37, // HopLimit = 0, reserved = 0, header length = 37 // ------------------------ - 0x00, 0x04, 0x00, 20, // ContentObject Fragment, length = 20 + 0x00, 0x05, 0x00, 20, // ContentObject Fragment, length = 20 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89,// fragid 0x1223344556677889 0x05, 0xDC, 0x01, 0x00,// MTU 1500, fragcnt 1, fragnum 0 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,// interest fragment 0x0102030405060708 + //----------------------- + 0x00, 0x03, 0x00, 1, //path label, lenght = 1 //36 bytes + 0x00, // ------------------------ 0x00, 0x02, 0x00, 58, // type = content object, length = 58 // ------------------------ @@ -101,17 +104,17 @@ static uint8_t v1_content_nameA_keyid1_rsasha256[] = { 'h', 'e', 'l', 'l', // "hello" 'o', 0xF0, 0x00, 0x00, 0x04,// type = app, length = 4 - 'o', 'u', 'c', 'h', // "ouch" + 'o', 'u', 'c', 'h', // "ouch" //62 bytes // ------------------------ 0x00, 0x05, 0x00, 1, // PayloadType 1, // type 1 = key - 0x00, 0x06, 0x00, 0x08,// expiry time in msec + 0x00, 0x06, 0x00, 0x08,// expiry time in msec //71 bytes 0x00, 0x00, 0x01, 0x43,// 1,388,534,400,000 msec 0x4B, 0x19, 0x84, 0x00, 0x00, 0x19, 0x00, 4, // end chunk number - 0x06, 0x05, 0x04, 0x03, + 0x06, 0x05, 0x04, 0x03, //87 bytes // ------------------------ - 0x00, 0x01, 0x00, 8, // payload, length = 8 + 0x00, 0x01, 0x00, 8, // payload, length = 8 //91 0x73, 0x75, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, // ------------------------ @@ -161,16 +164,16 @@ static TruthTableEntry TRUTHTABLENAME(v1_content_nameA_keyid1_rsasha256)[] = { { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_E2EFRAG, .bodyManifest = false, .extent = { 12, 20 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_CONTENTOBJECT, .bodyManifest = true, .extent = { 36, 58 } }, + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_CONTENTOBJECT, .bodyManifest = true, .extent = { 41, 58 } }, //36 //41 { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_NAME, .bodyManifest = true, .extent = { 40, 17 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOADTYPE, .bodyManifest = true, .extent = { 61, 1 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_EXPIRY_TIME, .bodyManifest = true, .extent = { 66, 8 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ENDSEGMENT, .bodyManifest = true, .extent = { 78, 4 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOAD, .bodyManifest = true, .extent = { 86, 8 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ValidationAlg, .bodyManifest = true, .extent = { 94, 206 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_KEYID, .bodyManifest = true, .extent = { 106, 32 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PUBKEY, .bodyManifest = true, .extent = { 142, 162 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_SIGBITS, .bodyManifest = true, .extent = { 308, 128 } }, + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOADTYPE, .bodyManifest = true, .extent = { 66, 1 } }, //61 //66 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_EXPIRY_TIME, .bodyManifest = true, .extent = { 71, 8 } }, //66 //71 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ENDSEGMENT, .bodyManifest = true, .extent = { 83, 4 } }, //78 //83 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOAD, .bodyManifest = true, .extent = { 91, 8 } }, //86 //91 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ValidationAlg, .bodyManifest = true, .extent = { 94, 206 } }, //94 //99 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_KEYID, .bodyManifest = true, .extent = { 111, 32 } }, //106 //111 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PUBKEY, .bodyManifest = true, .extent = { 147, 162 } }, //142 //147 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_SIGBITS, .bodyManifest = true, .extent = { 313, 128 } }, //308 //313 { .wellKnownType = false, .indexOrKey = T_INVALID, .extent = { 0, 0 } }, }; diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameless_nosig.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameless_nosig.h index f1fc59cb..5b6d304f 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameless_nosig.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_content_nameless_nosig.h @@ -52,11 +52,11 @@ __attribute__((unused)) static TruthTableEntry TRUTHTABLENAME(v1_content_nameless_nosig)[] = { - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_CONTENTOBJECT, .bodyManifest = true, .extent = { 12, 37 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOADTYPE, .bodyManifest = true, .extent = { 17, 1 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_EXPIRY_TIME, .bodyManifest = true, .extent = { 22, 8 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ENDSEGMENT, .bodyManifest = true, .extent = { 30, 4 } }, - { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOAD, .bodyManifest = true, .extent = { 41, 8 } }, + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_CONTENTOBJECT, .bodyManifest = true, .extent = { 12, 37 } }, //12 //17 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOADTYPE, .bodyManifest = true, .extent = { 17, 1 } }, //17 //22 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_EXPIRY_TIME, .bodyManifest = true, .extent = { 22, 8 } }, //22 //27 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_ENDSEGMENT, .bodyManifest = true, .extent = { 30, 4 } }, //30 //35 + { .wellKnownType = true, .indexOrKey = V1_MANIFEST_OBJ_PAYLOAD, .bodyManifest = true, .extent = { 41, 8 } }, //41 //46 { .wellKnownType = false, .indexOrKey = T_INVALID, .extent = { 0, 0 } }, }; diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_bad_validation_alg.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_bad_validation_alg.h index 9c4c3117..01a2efbc 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_bad_validation_alg.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_bad_validation_alg.h @@ -36,7 +36,7 @@ static uint8_t v1_interest_bad_validation_alg[] = { 0x01, 0x00, 0x00, 65, // ver = 1, type = interest, length = 65 0x20, 0x00, 0x00, 24, // HopLimit = 32, reserved = 0, header length = 24 // ------------------------ - 0x00, 0x03, 0x00, 12, // Interest Fragment + 0x00, 0x04, 0x00, 12, // Interest Fragment 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // fragment 0x0102030405060708 0x05, 0xDC, 0x00, 0x00, // MTU 1500, fragcnt 0, fragnum 0 diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA.h index 4bee1e40..10495303 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA.h @@ -38,7 +38,7 @@ static uint8_t v1_interest_nameA[] = { 0x20, 0x00, 0x00, 36, // HopLimit = 31, reserved = 0, header length = 36 // ------------------------ // ------------------------ - 0x00, 0x03, 0x00, 12, // Interest Fragment + 0x00, 0x04, 0x00, 12, // Interest Fragment 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // fragment 0x0102030405060708 0x05, 0xDC, 0x00, 0x00, // MTU 1500, fragcnt 0, fragnum 0 diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_badcrc32c.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_badcrc32c.h index 6af04f42..d9fd0e13 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_badcrc32c.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_badcrc32c.h @@ -36,7 +36,7 @@ static uint8_t v1_interest_nameA_badcrc32c[] = { 0x01, 0x00, 0x00, 41, // ver = 1, type = interest, length = 65 0x20, 0x00, 0x00, 24, // HopLimit = 31, reserved = 0, header length = 24 // ------------------------ - 0x00, 0x03, 0x00, 0x0C, // Interest Fragment + 0x00, 0x04, 0x00, 0x0C, // Interest Fragment 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // fragment 0x0102030405060708 0x05, 0xDC, 0x00, 0x00, // MTU 1500, fragcnt 0, fragnum 0 diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_crc32c.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_crc32c.h index 64edf560..b71e0f90 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_crc32c.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_nameA_crc32c.h @@ -56,7 +56,7 @@ 0x01, _type, 0x00, 65, /* ver = 1, type = interest, length = 65 */ \ 0x20, _code, 0x00, 24, /* HopLimit = 32, reserved = 0, header length = 24*/ \ /* ------------------------ */ \ - 0x00, 0x03, 0x00, 12, /* Interest Fragment */ \ + 0x00, 0x04, 0x00, 12, /* Interest Fragment */ \ 0x01, 0x02, 0x03, 0x04, \ 0x05, 0x06, 0x07, 0x08, /* fragment 0x0102030405060708 */ \ 0x05, 0xDC, 0x00, 0x00, /* MTU 1500, fragcnt 0, fragnum 0 */ \ diff --git a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_validation_alg_overrun.h b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_validation_alg_overrun.h index 8f3b55a5..3d188c23 100644 --- a/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_validation_alg_overrun.h +++ b/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_interest_validation_alg_overrun.h @@ -36,7 +36,7 @@ static uint8_t v1_interest_validation_alg_overrun[] = { 0x01, 0x00, 0x00, 65, // ver = 1, type = interest, length = 65 0x20, 0x00, 0x00, 24, // HopLimit = 32, reserved = 0, header length = 24 // ------------------------ - 0x00, 0x03, 0x00, 12, // Interest Fragment + 0x00, 0x04, 0x00, 12, // Interest Fragment 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // fragment 0x0102030405060708 0x05, 0xDC, 0x00, 0x00, // MTU 1500, fragcnt 0, fragnum 0 |