aboutsummaryrefslogtreecommitdiffstats
path: root/libccnx-transport-rta/ccnx/transport/common/test
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar+fdio@cisco.com>2017-02-23 20:44:26 +0100
committerLuca Muscariello <lumuscar+fdio@cisco.com>2017-02-23 19:51:14 +0000
commitd18ae43123fcd7604d1c36a1ec8450dbe6071824 (patch)
tree2d49fc3aabd0f2607251c854565648d47b56b2e9 /libccnx-transport-rta/ccnx/transport/common/test
parent9b30fc10fb1cbebe651e5a107e8ca5b24de54675 (diff)
Initial commit: ccnxlibs.
Change-Id: I1b376527a7dd01a6b9e083a6cb646955902f45c0 Signed-off-by: Luca Muscariello <lumuscar+fdio@cisco.com>
Diffstat (limited to 'libccnx-transport-rta/ccnx/transport/common/test')
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/.gitignore4
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/CMakeLists.txt16
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_ConnectionConfig.c183
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_StackConfig.c226
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_TransportConfig.c226
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_transport.c136
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_transport_Message.c15
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_transport_MetaMessage.c283
-rw-r--r--libccnx-transport-rta/ccnx/transport/common/test/test_transport_Stack.c191
9 files changed, 1280 insertions, 0 deletions
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/.gitignore b/libccnx-transport-rta/ccnx/transport/common/test/.gitignore
new file mode 100644
index 00000000..6fd12a5f
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/.gitignore
@@ -0,0 +1,4 @@
+test_transport_MetaMessage
+test_ccnx_ConnectionConfig
+test_ccnx_StackConfig
+test_ccnx_TransportConfig
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/CMakeLists.txt b/libccnx-transport-rta/ccnx/transport/common/test/CMakeLists.txt
new file mode 100644
index 00000000..c964fc69
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Enable gcov output for the tests
+add_definitions(--coverage)
+set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage")
+
+set(TestsExpectedToPass
+ test_transport_MetaMessage
+ test_ccnx_ConnectionConfig
+ test_ccnx_StackConfig
+ test_ccnx_TransportConfig
+)
+
+
+foreach(test ${TestsExpectedToPass})
+ AddTest(${test})
+endforeach()
+
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_ConnectionConfig.c b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_ConnectionConfig.c
new file mode 100644
index 00000000..2bc4d121
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_ConnectionConfig.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Include the file(s) containing the functions to be tested.
+// This permits internal static functions to be visible to this Test Runner.
+#include "../ccnx_ConnectionConfig.c"
+
+#include <LongBow/unit-test.h>
+
+#include <parc/algol/parc_SafeMemory.h>
+#include <parc/testing/parc_MemoryTesting.h>
+#include <parc/testing/parc_ObjectTesting.h>
+
+LONGBOW_TEST_RUNNER(ccnx_ConnectionConfig)
+{
+ // The following Test Fixtures will run their corresponding Test Cases.
+ // Test Fixtures are run in the order specified here, but every test must be idempotent.
+ // Never rely on the execution order of tests or share state between them.
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+ LONGBOW_RUN_TEST_FIXTURE(Static);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(ccnx_ConnectionConfig)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(ccnx_ConnectionConfig)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_Add);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_AssertValid);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_Equals);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_Copy);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_CreateDestroy);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_Display);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_GetJson);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxConnectionConfig_IsValid);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ parcSafeMemory_ReportAllocation(STDOUT_FILENO);
+
+ if (!parcMemoryTesting_ExpectedOutstanding(0, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_Add)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+
+ PARCJSONValue *val = parcJSONValue_CreateFromNULL();
+ ccnxConnectionConfig_Add(config, "key", val);
+ parcJSONValue_Release(&val);
+
+ ccnxConnectionConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_AssertValid)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+ ccnxConnectionConfig_AssertValid(config);
+ ccnxConnectionConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_Equals)
+{
+ CCNxConnectionConfig *x = ccnxConnectionConfig_Create();
+ CCNxConnectionConfig *y = ccnxConnectionConfig_Create();
+ CCNxConnectionConfig *z = ccnxConnectionConfig_Create();
+ CCNxConnectionConfig *u1 = ccnxConnectionConfig_Create();
+ PARCJSONValue *val = parcJSONValue_CreateFromNULL();
+ ccnxConnectionConfig_Add(u1, "key", val);
+ parcJSONValue_Release(&val);
+
+ parcObjectTesting_AssertEqualsFunction(ccnxConnectionConfig_Equals, x, y, z, u1);
+
+ ccnxConnectionConfig_Destroy(&x);
+ ccnxConnectionConfig_Destroy(&y);
+ ccnxConnectionConfig_Destroy(&z);
+ ccnxConnectionConfig_Destroy(&u1);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_Copy)
+{
+ CCNxConnectionConfig *x = ccnxConnectionConfig_Create();
+ PARCJSONValue *val = parcJSONValue_CreateFromNULL();
+ ccnxConnectionConfig_Add(x, "key", val);
+ parcJSONValue_Release(&val);
+
+ CCNxConnectionConfig *y = ccnxConnectionConfig_Copy(x);
+ assertTrue(ccnxConnectionConfig_Equals(x, y), "Expected the copy to be equal to the original");
+ ccnxConnectionConfig_Destroy(&x);
+ ccnxConnectionConfig_Destroy(&y);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_CreateDestroy)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+ assertNotNull(config, "Expected non-NULL result from ccnxConnectionConfig_Create.");
+ ccnxConnectionConfig_Destroy(&config);
+ assertNull(config, "Expected NULL result from ccnxConnectionConfig_Destroy");
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_Display)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+ ccnxConnectionConfig_Display(config, 0);
+
+ ccnxConnectionConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_GetJson)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+
+ PARCJSON *json = ccnxConnectionConfig_GetJson(config);
+
+ assertNotNull(json, "Expected ccnxConnectionConfig_GetJson result to be non-null.");
+ ccnxConnectionConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxConnectionConfig_IsValid)
+{
+ CCNxConnectionConfig *config = ccnxConnectionConfig_Create();
+ assertTrue(ccnxConnectionConfig_IsValid(config), "Expected ccnxConnectionConfig_Create result to be valid.");
+
+ ccnxConnectionConfig_Destroy(&config);
+ assertFalse(ccnxConnectionConfig_IsValid(config), "Expected ccnxConnectionConfig_Destroy result to be invalid.");
+}
+
+LONGBOW_TEST_FIXTURE(Static)
+{
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+int
+main(int argc, char *argv[])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(ccnx_ConnectionConfig);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_StackConfig.c b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_StackConfig.c
new file mode 100644
index 00000000..4f1ee7dc
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_StackConfig.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Include the file(s) containing the functions to be tested.
+// This permits internal static functions to be visible to this Test Runner.
+#include "../ccnx_StackConfig.c"
+#include <LongBow/unit-test.h>
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#include <parc/algol/parc_SafeMemory.h>
+#include <parc/testing/parc_MemoryTesting.h>
+#include <parc/testing/parc_ObjectTesting.h>
+
+LONGBOW_TEST_RUNNER(ccnx_StackConfig)
+{
+ // The following Test Fixtures will run their corresponding Test Cases.
+ // Test Fixtures are run in the order specified here, but every test must be idempotent.
+ // Never rely on the execution order of tests or share state between them.
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+ LONGBOW_RUN_TEST_FIXTURE(Static);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(ccnx_StackConfig)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(ccnx_StackConfig)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_AddGet);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_AssertValid);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_Copy);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_CreateAcquireRelease);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_Display);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_Equals);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_HashCode);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_GetJson);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_IsValid);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_ToJSON);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxStackConfig_ToString);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ if (!parcMemoryTesting_ExpectedOutstanding(0, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_AddGet)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+
+ PARCJSONValue *expected = parcJSONValue_CreateFromNULL();
+ ccnxStackConfig_Add(instance, "key", expected);
+
+ PARCJSONValue *actual = ccnxStackConfig_Get(instance, "key");
+
+ assertTrue(parcJSONValue_Equals(expected, actual), "ccnxStackConfig_Get did not return what was 'added'");
+
+ parcJSONValue_Release(&expected);
+
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_AssertValid)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ ccnxStackConfig_AssertValid(instance);
+
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_Copy)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ CCNxStackConfig *copy = ccnxStackConfig_Copy(instance);
+ assertTrue(ccnxStackConfig_Equals(instance, copy), "Expected the copy to be equal to the original");
+
+ ccnxStackConfig_Release(&instance);
+ ccnxStackConfig_Release(&copy);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_CreateAcquireRelease)
+{
+ CCNxStackConfig *config = ccnxStackConfig_Create();
+ assertNotNull(config, "Expected non-NULL result from ccnxConnectionConfig_Create.");
+
+ CCNxStackConfig *reference = ccnxStackConfig_Acquire(config);
+
+ ccnxStackConfig_Release(&config);
+ assertNull(config, "Expected NULL result from ccnxConnectionConfig_Destroy");
+ ccnxStackConfig_Release(&reference);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_Display)
+{
+ CCNxStackConfig *config = ccnxStackConfig_Create();
+ ccnxStackConfig_Display(config, 1);
+
+ ccnxStackConfig_Release(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_Equals)
+{
+ CCNxStackConfig *x = ccnxStackConfig_Create();
+ CCNxStackConfig *y = ccnxStackConfig_Create();
+ CCNxStackConfig *z = ccnxStackConfig_Create();
+
+ CCNxStackConfig *u1 = ccnxStackConfig_Create();
+ PARCJSONValue *val = parcJSONValue_CreateFromNULL();
+ ccnxStackConfig_Add(u1, "key", val);
+ parcJSONValue_Release(&val);
+
+ parcObjectTesting_AssertEquals(x, y, z, NULL);
+
+ ccnxStackConfig_Release(&x);
+ ccnxStackConfig_Release(&y);
+ ccnxStackConfig_Release(&z);
+ ccnxStackConfig_Release(&u1);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_HashCode)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ uint64_t hashCode = ccnxStackConfig_HashCode(instance);
+ printf("%" PRIu64 "\n", hashCode);
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_GetJson)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ PARCJSON *json = ccnxStackConfig_GetJson(instance);
+
+ assertNotNull(json, "Expected non-null JSON");
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_IsValid)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ assertTrue(ccnxStackConfig_IsValid(instance), "Expected ccnxStackConfig_Create to result in a valid instance.");
+
+ ccnxStackConfig_Release(&instance);
+ assertFalse(ccnxStackConfig_IsValid(instance), "Expected ccnxStackConfig_Create to result in an invalid instance.");
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_ToJSON)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ PARCJSON *json = ccnxStackConfig_ToJSON(instance);
+ assertNotNull(json, "Expected non-null JSON");
+
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_ToString)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+ char *string = ccnxStackConfig_ToString(instance);
+ assertNotNull(string, "Expected non-null ccnxStackConfig_ToString");
+
+ parcMemory_Deallocate((void **) &string);
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxStackConfig_Get)
+{
+ CCNxStackConfig *instance = ccnxStackConfig_Create();
+
+ ccnxStackConfig_Release(&instance);
+}
+
+LONGBOW_TEST_FIXTURE(Static)
+{
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+int
+main(int argc, char *argv[])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(ccnx_StackConfig);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_TransportConfig.c b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_TransportConfig.c
new file mode 100644
index 00000000..8b954419
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_ccnx_TransportConfig.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Include the file(s) containing the functions to be tested.
+// This permits internal static functions to be visible to this Test Runner.
+#include "../ccnx_TransportConfig.c"
+
+#include <LongBow/unit-test.h>
+
+#include <parc/testing/parc_MemoryTesting.h>
+#include <parc/testing/parc_ObjectTesting.h>
+#include <parc/algol/parc_SafeMemory.h>
+
+
+LONGBOW_TEST_RUNNER(ccnx_TransportConfig)
+{
+ // The following Test Fixtures will run their corresponding Test Cases.
+ // Test Fixtures are run in the order specified here, but every test must be idempotent.
+ // Never rely on the execution order of tests or share state between them.
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+ LONGBOW_RUN_TEST_FIXTURE(Static);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(ccnx_TransportConfig)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(ccnx_TransportConfig)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_AssertValid);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_Copy);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_CreateDestroy);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_GetConnectionConfig);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_Equals);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_GetStackConfig);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_IsValid_True);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxTransportConfig_IsValid_False);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ parcSafeMemory_ReportAllocation(STDOUT_FILENO);
+
+ if (!parcMemoryTesting_ExpectedOutstanding(0, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_AssertValid)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *x = ccnxTransportConfig_Create(stack, connection);
+
+ ccnxTransportConfig_AssertValid(x);
+
+ ccnxStackConfig_Release(&stack);
+
+ ccnxTransportConfig_Destroy(&x);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_Copy)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *x = ccnxTransportConfig_Create(stack, connection);
+ assertNotNull(x, "Expected non-null result from ccnxTransportConfig_Create");
+ ccnxStackConfig_Release(&stack);
+
+ CCNxTransportConfig *y = ccnxTransportConfig_Copy(x);
+
+ assertTrue(ccnxTransportConfig_Equals(x, y), "Expected ccnxTransportConfig_Copy result to be equal to the original");
+
+ ccnxTransportConfig_Destroy(&x);
+ ccnxTransportConfig_Destroy(&y);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_Equals)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *x = ccnxTransportConfig_Create(stack, ccnxConnectionConfig_Copy(connection));
+ CCNxTransportConfig *y = ccnxTransportConfig_Create(stack, ccnxConnectionConfig_Copy(connection));
+ CCNxTransportConfig *z = ccnxTransportConfig_Create(stack, ccnxConnectionConfig_Copy(connection));
+
+ CCNxStackConfig *otherStack = ccnxStackConfig_Create();
+ PARCJSONValue *val = parcJSONValue_CreateFromNULL();
+ ccnxStackConfig_Add(otherStack, "key", val);
+ CCNxTransportConfig *u1 = ccnxTransportConfig_Create(otherStack, ccnxConnectionConfig_Copy(connection));
+
+ CCNxConnectionConfig *otherConnection = ccnxConnectionConfig_Create();
+ ccnxConnectionConfig_Add(otherConnection, "key", val);
+
+ CCNxTransportConfig *u2 = ccnxTransportConfig_Create(stack, otherConnection);
+
+ parcObjectTesting_AssertEqualsFunction(ccnxTransportConfig_Equals, x, y, z, u1, u2);
+
+ assertTrue(ccnxTransportConfig_Equals(x, y), "Expected ccnxTransportConfig_Copy result to be equal to the original");
+
+ parcJSONValue_Release(&val);
+ ccnxStackConfig_Release(&stack);
+ ccnxStackConfig_Release(&otherStack);
+ ccnxConnectionConfig_Destroy(&connection);
+
+ ccnxTransportConfig_Destroy(&x);
+ ccnxTransportConfig_Destroy(&y);
+ ccnxTransportConfig_Destroy(&z);
+ ccnxTransportConfig_Destroy(&u1);
+ ccnxTransportConfig_Destroy(&u2);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_CreateDestroy)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *x = ccnxTransportConfig_Create(stack, connection);
+ assertNotNull(x, "Expected non-null result from ccnxTransportConfig_Create");
+ ccnxStackConfig_Release(&stack);
+
+ ccnxTransportConfig_Destroy(&x);
+ assertNull(x, "Expected null result from ccnxStackConfig_Release");
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_GetConnectionConfig)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *config = ccnxTransportConfig_Create(stack, connection);
+ ccnxStackConfig_Release(&stack);
+
+ CCNxConnectionConfig *actual = ccnxTransportConfig_GetConnectionConfig(config);
+
+ assertTrue(connection == actual, "Expected ccnxTransportConfig_GetConnectionConfig to return the original.");
+
+ ccnxTransportConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_GetStackConfig)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *config = ccnxTransportConfig_Create(stack, connection);
+
+ CCNxStackConfig *actual = ccnxTransportConfig_GetStackConfig(config);
+
+ assertTrue(stack == actual, "Expected ccnxTransportConfig_GetStackConfig to return the original.");
+
+ ccnxStackConfig_Release(&stack);
+ ccnxTransportConfig_Destroy(&config);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_IsValid_True)
+{
+ CCNxStackConfig *stack = ccnxStackConfig_Create();
+ CCNxConnectionConfig *connection = ccnxConnectionConfig_Create();
+
+ CCNxTransportConfig *x = ccnxTransportConfig_Create(stack, connection);
+ assertTrue(ccnxTransportConfig_IsValid(x), "Expected ccnxTransportConfig_Create to return a valid instance.");
+ ccnxStackConfig_Release(&stack);
+
+ ccnxTransportConfig_Destroy(&x);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxTransportConfig_IsValid_False)
+{
+ assertFalse(ccnxTransportConfig_IsValid(NULL), "Expected NULL to be an invalid instance.");
+}
+
+LONGBOW_TEST_FIXTURE(Static)
+{
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+int
+main(int argc, char *argv[])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(ccnx_TransportConfig);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_transport.c b/libccnx-transport-rta/ccnx/transport/common/test/test_transport.c
new file mode 100644
index 00000000..2642acd6
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_transport.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Include the file(s) containing the functions to be tested.
+// This permits internal static functions to be visible to this Test Runner.
+#include "../transport.c"
+
+#include <LongBow/unit-test.h>
+
+#include <parc/algol/parc_SafeMemory.h>
+#include <parc/testing/parc_TestingMemory.h>
+
+LONGBOW_TEST_RUNNER(transport)
+{
+ // The following Test Fixtures will run their corresponding Test Cases.
+ // Test Fixtures are run in the order specified here, but every test must be idempotent.
+ // Never rely on the execution order of tests or share state between them.
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+ LONGBOW_RUN_TEST_FIXTURE(Static);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(transport)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(transport)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Create_RTA);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Close);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Destroy);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Open);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_PassCommand);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Recv);
+ LONGBOW_RUN_TEST_CASE(Global, Transport_Send);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ LongBowStatus result = LONGBOW_STATUS_SUCCEEDED;
+ if (parcTestingMemory_ExpectedOutstanding(0, "%s", longBowTestCase_GetFullName(testCase)) == false) {
+ result = LONGBOW_STATUS_MEMORYLEAK;
+ }
+ return result;
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Close)
+{
+ testUnimplemented("");
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Create_RTA)
+{
+ TransportContext *transport = Transport_Create(TRANSPORT_RTA);
+
+ Transport_Destroy(&transport);
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Destroy)
+{
+ TransportContext *transport = Transport_Create(TRANSPORT_RTA);
+
+ Transport_Destroy(&transport);
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Open)
+{
+ TransportContext *transport = Transport_Create(TRANSPORT_RTA);
+
+
+ Transport_Destroy(&transport);
+}
+
+LONGBOW_TEST_CASE(Global, Transport_PassCommand)
+{
+ testUnimplemented("");
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Recv)
+{
+ testUnimplemented("");
+}
+
+LONGBOW_TEST_CASE(Global, Transport_Send)
+{
+ testUnimplemented("");
+}
+
+LONGBOW_TEST_FIXTURE(Static)
+{
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Static)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+int
+main(int argc, char *argv[])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(transport);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Message.c b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Message.c
new file mode 100644
index 00000000..ec9e3a04
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Message.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_transport_MetaMessage.c b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_MetaMessage.c
new file mode 100644
index 00000000..3896d945
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_MetaMessage.c
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../transport_MetaMessage.c"
+#include <stdio.h>
+
+#include <LongBow/unit-test.h>
+
+#include <parc/algol/parc_SafeMemory.h>
+
+#include <ccnx/common/validation/ccnxValidation_CRC32C.h>
+
+LONGBOW_TEST_RUNNER(ccnx_MetaMessage)
+{
+ parcMemory_SetInterface(&PARCSafeMemoryAsPARCMemory);
+
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+ LONGBOW_RUN_TEST_FIXTURE(Local);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(ccnx_MetaMessage)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(ccnx_MetaMessage)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_Acquire_Release);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_CreateFromContentObject);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_CreateFromControl);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_CreateFromInterest);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_Display);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_GetContentObject);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_GetControl);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_GetInterest);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_IsContentObject);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_IsControl);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_IsInterest);
+ LONGBOW_RUN_TEST_CASE(Global, ccnxMetaMessage_EncodeDecode);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ uint32_t outstandingAllocations = parcSafeMemory_ReportAllocation(STDERR_FILENO);
+ if (outstandingAllocations != 0) {
+ printf("%s leaks memory by %d allocations\n", longBowTestCase_GetName(testCase), outstandingAllocations);
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_Acquire_Release)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ CCNxInterest *interest = ccnxInterest_CreateSimple(name);
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromInterest(interest);
+
+ CCNxMetaMessage *ref1 = ccnxMetaMessage_Acquire(portalMessage);
+ CCNxMetaMessage *ref2 = ccnxMetaMessage_Acquire(portalMessage);
+ CCNxMetaMessage *ref3 = ccnxMetaMessage_Acquire(portalMessage);
+
+ ccnxMetaMessage_Release(&ref1);
+ assertNull(ref1, "Expected pointer to pointer to be null after Release()");
+
+ ccnxMetaMessage_Release(&ref2);
+ assertNull(ref2, "Expected pointer to pointer to be null after Release()");
+
+ ccnxMetaMessage_Release(&ref3);
+ assertNull(ref3, "Expected pointer to pointer to be null after Release()");
+
+ ccnxMetaMessage_Release(&portalMessage);
+ ccnxInterest_Release(&interest);
+ ccnxName_Release(&name);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_CreateFromContentObject)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ PARCBuffer *payload = parcBuffer_WrapCString("This is some data. It's not good data, but it is data.");
+ CCNxContentObject *contentObject = ccnxContentObject_CreateWithNameAndPayload(name, payload);
+
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromContentObject(contentObject);
+ assertNotNull(portalMessage, "Expected a non-null portal message");
+ ccnxMetaMessage_Release(&portalMessage);
+
+ ccnxContentObject_Release(&contentObject);
+ parcBuffer_Release(&payload);
+ ccnxName_Release(&name);
+}
+
+#ifndef BUGZID_712
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_CreateFromControl)
+{
+ testUnimplemented("");
+}
+#endif // !BUGZID_712
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_CreateFromInterest)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ CCNxInterest *interest = ccnxInterest_CreateSimple(name);
+
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromInterest(interest);
+ assertNotNull(portalMessage, "Expected a non-null portal message");
+ ccnxMetaMessage_Release(&portalMessage);
+
+ ccnxInterest_Release(&interest);
+ ccnxName_Release(&name);
+}
+
+#ifndef BUGZID_712
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_Display)
+{
+ testUnimplemented("");
+}
+#endif // !BUGZID_712
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_GetContentObject)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ PARCBuffer *payload = parcBuffer_WrapCString("This is some data. It's not good data, but it is data.");
+ CCNxContentObject *contentObject = ccnxContentObject_CreateWithNameAndPayload(name, payload);
+
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromContentObject(contentObject);
+
+ CCNxContentObject *reference = ccnxMetaMessage_GetContentObject(portalMessage);
+
+#ifndef BUGZID_712
+ // TODO: We need a ccnxContentObject_Equals()!
+ // assertTrue(ccnxContentObject_Equals(contentObject, reference), "Expected reference to equal original contentObject");
+#endif // !BUGZID_712
+ ccnxContentObject_AssertValid(reference);
+
+ ccnxMetaMessage_Release(&portalMessage);
+
+ ccnxContentObject_Release(&contentObject);
+ parcBuffer_Release(&payload);
+ ccnxName_Release(&name);
+}
+
+#ifndef BUGZID_712
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_GetControl)
+{
+ testUnimplemented("");
+}
+#endif // !BUGZID_712
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_GetInterest)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ CCNxInterest *interest = ccnxInterest_CreateSimple(name);
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromInterest(interest);
+ CCNxInterest *reference = ccnxMetaMessage_GetInterest(portalMessage);
+
+ assertTrue(ccnxInterest_Equals(interest, reference), "Expected reference to equal original interest");
+ ccnxInterest_AssertValid(reference);
+
+ ccnxInterest_Release(&reference);
+ ccnxMetaMessage_Release(&portalMessage);
+ ccnxName_Release(&name);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_IsContentObject)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ PARCBuffer *payload = parcBuffer_WrapCString("This is some data. It's not good data, but it is data.");
+ CCNxContentObject *contentObject = ccnxContentObject_CreateWithNameAndPayload(name, payload);
+
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromContentObject(contentObject);
+
+ assertTrue(ccnxMetaMessage_IsContentObject(portalMessage), "Expected portal message to be an ContentObject");
+ assertFalse(ccnxMetaMessage_IsInterest(portalMessage), "Did not expect portal message to be an Interest");
+ assertFalse(ccnxMetaMessage_IsControl(portalMessage), "Did not expect portal message to be a Control message");
+
+ ccnxMetaMessage_Release(&portalMessage);
+ ccnxContentObject_Release(&contentObject);
+ parcBuffer_Release(&payload);
+ ccnxName_Release(&name);
+}
+
+#ifndef BUGZID_712
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_IsControl)
+{
+ testUnimplemented("");
+}
+#endif // !BUGZID_712
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_IsInterest)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ CCNxInterest *interest = ccnxInterest_CreateSimple(name);
+ CCNxMetaMessage *portalMessage = ccnxMetaMessage_CreateFromInterest(interest);
+
+ assertTrue(ccnxMetaMessage_IsInterest(portalMessage), "Expected portal message to be an Interest");
+ assertFalse(ccnxMetaMessage_IsContentObject(portalMessage), "Did not expect portal message to be a ContentObject");
+ assertFalse(ccnxMetaMessage_IsControl(portalMessage), "Did not expect portal message to be a Control message");
+
+ ccnxMetaMessage_Release(&portalMessage);
+ ccnxInterest_Release(&interest);
+ ccnxName_Release(&name);
+}
+
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_EncodeDecode)
+{
+ CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
+ CCNxInterest *interest = ccnxInterest_CreateSimple(name);
+ ccnxName_Release(&name);
+
+ PARCSigner *signer = ccnxValidationCRC32C_CreateSigner(); // Would really be SHA256 or something.
+
+ // Encode it to wire format.
+ PARCBuffer *wireFormatBuffer = ccnxMetaMessage_CreateWireFormatBuffer(interest, signer);
+
+ // Now decode it from wireformat.
+ CCNxMetaMessage *decodedMessage = ccnxMetaMessage_CreateFromWireFormatBuffer(wireFormatBuffer);
+
+ // At this point, the unpacked dictionary should be equivalent to the original interest.
+ assertTrue(ccnxInterest_Equals(interest, decodedMessage), "Expected an equivalent interest to be unpacked");
+
+ parcBuffer_Release(&wireFormatBuffer);
+ ccnxInterest_Release(&interest);
+ ccnxMetaMessage_Release(&decodedMessage);
+ parcSigner_Release(&signer);
+}
+
+#ifndef BUGZID_712
+LONGBOW_TEST_CASE(Global, ccnxMetaMessage_Release)
+{
+ testUnimplemented("");
+}
+#endif // !BUGZID_712
+
+LONGBOW_TEST_FIXTURE(Local)
+{
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Local)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Local)
+{
+ uint32_t outstandingAllocations = parcSafeMemory_ReportAllocation(STDERR_FILENO);
+ if (outstandingAllocations != 0) {
+ printf("%s leaks memory by %d allocations\n", longBowTestCase_GetName(testCase), outstandingAllocations);
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+int
+main(int argc, char *argv[])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(ccnx_MetaMessage);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
diff --git a/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Stack.c b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Stack.c
new file mode 100644
index 00000000..4a10d962
--- /dev/null
+++ b/libccnx-transport-rta/ccnx/transport/common/test/test_transport_Stack.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../transport_Stack.c"
+
+#include <LongBow/testing.h>
+#include <LongBow/debugging.h>
+#include <parc/algol/parc_Memory.h>
+#include <parc/algol/parc_SafeMemory.h>
+#include <parc/algol/parc_DisplayIndented.h>
+
+#include <parc/testing/parc_MemoryTesting.h>
+#include <parc/testing/parc_ObjectTesting.h>
+
+LONGBOW_TEST_RUNNER(transport_Stack)
+{
+ // The following Test Fixtures will run their corresponding Test Cases.
+ // Test Fixtures are run in the order specified, but all tests should be idempotent.
+ // Never rely on the execution order of tests or share state between them.
+ LONGBOW_RUN_TEST_FIXTURE(CreateAcquireRelease);
+ LONGBOW_RUN_TEST_FIXTURE(Global);
+}
+
+// The Test Runner calls this function once before any Test Fixtures are run.
+LONGBOW_TEST_RUNNER_SETUP(transport_Stack)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+// The Test Runner calls this function once after all the Test Fixtures are run.
+LONGBOW_TEST_RUNNER_TEARDOWN(transport_Stack)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE(CreateAcquireRelease)
+{
+ LONGBOW_RUN_TEST_CASE(CreateAcquireRelease, CreateRelease);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(CreateAcquireRelease)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(CreateAcquireRelease)
+{
+ if (!parcMemoryTesting_ExpectedOutstanding(0, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(CreateAcquireRelease, CreateRelease)
+{
+ TransportStack *instance = transportStack_Create();
+ assertNotNull(instance, "Expected non-null result from transportStack_Create();");
+
+ parcObjectTesting_AssertAcquireReleaseContract(instance);
+
+ transportStack_Release(&instance);
+ assertNull(instance, "Expected null result from transportStack_Release();");
+}
+
+LONGBOW_TEST_FIXTURE(Global)
+{
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_Compare);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_Copy);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_Display);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_Equals);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_HashCode);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_IsValid);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_ToJSON);
+ LONGBOW_RUN_TEST_CASE(Global, transportStack_ToString);
+}
+
+LONGBOW_TEST_FIXTURE_SETUP(Global)
+{
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
+{
+ if (!parcMemoryTesting_ExpectedOutstanding(0, "%s mismanaged memory.", longBowTestCase_GetFullName(testCase))) {
+ return LONGBOW_STATUS_MEMORYLEAK;
+ }
+
+ return LONGBOW_STATUS_SUCCEEDED;
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_Compare)
+{
+ testUnimplemented("");
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_Copy)
+{
+ TransportStack *instance = transportStack_Create();
+ TransportStack *copy = transportStack_Copy(instance);
+ assertTrue(transportStack_Equals(instance, copy), "Expected the copy to be equal to the original");
+
+ transportStack_Release(&instance);
+ transportStack_Release(&copy);
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_Display)
+{
+ TransportStack *instance = transportStack_Create();
+ transportStack_Display(instance, 0);
+ transportStack_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_Equals)
+{
+ TransportStack *x = transportStack_Create();
+ TransportStack *y = transportStack_Create();
+ TransportStack *z = transportStack_Create();
+
+ parcObjectTesting_AssertEquals(x, y, z, NULL);
+
+ transportStack_Release(&x);
+ transportStack_Release(&y);
+ transportStack_Release(&z);
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_HashCode)
+{
+ TransportStack *x = transportStack_Create();
+ TransportStack *y = transportStack_Create();
+
+ parcObjectTesting_AssertHashCode(x, y);
+
+ transportStack_Release(&x);
+ transportStack_Release(&y);
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_IsValid)
+{
+ TransportStack *instance = transportStack_Create();
+ assertTrue(transportStack_IsValid(instance), "Expected transportStack_Create to result in a valid instance.");
+
+ transportStack_Release(&instance);
+ assertFalse(transportStack_IsValid(instance), "Expected transportStack_Release to result in an invalid instance.");
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_ToJSON)
+{
+ TransportStack *instance = transportStack_Create();
+
+ PARCJSON *json = transportStack_ToJSON(instance);
+
+ parcJSON_Release(&json);
+
+ transportStack_Release(&instance);
+}
+
+LONGBOW_TEST_CASE(Global, transportStack_ToString)
+{
+ TransportStack *instance = transportStack_Create();
+
+ char *string = transportStack_ToString(instance);
+
+ assertNotNull(string, "Expected non-NULL result from transportStack_ToString");
+
+ parcMemory_Deallocate((void **) &string);
+ transportStack_Release(&instance);
+}
+
+int
+main(int argc, char *argv[argc])
+{
+ LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(transport_Stack);
+ int exitStatus = longBowMain(argc, argv, testRunner, NULL);
+ longBowTestRunner_Destroy(&testRunner);
+ exit(exitStatus);
+}
+
+