Loading src/lib/kinetic_allocator.c +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ KineticConnection* KineticAllocator_NewConnection(void) LOG0("Failed allocating new Connection!"); return NULL; } connection->socket = -1; // start without a file descriptor return connection; } Loading test/unit/test_kinetic_allocator.c +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ void test_KineticAllocator_NewConnection_should_return_a_connection_with_connect TEST_ASSERT_FALSE(connection->connected); } void test_KineticAllocator_NewConnection_should_return_a_connection_with_a_minus1_fd(void) { calloc_ExpectAndReturn(1, sizeof(KineticConnection), &Connection); KineticConnection* connection = KineticAllocator_NewConnection(); TEST_ASSERT_NOT_NULL(connection); TEST_ASSERT_EQUAL(-1, connection->socket); } void test_KineticAllocator_NewKineticResponse_should_return_null_if_calloc_return_null(void) { calloc_ExpectAndReturn(1, sizeof(KineticResponse) + 1234, NULL); Loading test/unit/test_kinetic_session.c +1 −20 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ void setUp(void) .host = "somehost.com", .port = 17, }; KINETIC_CONNECTION_INIT(&Connection); memset(&Connection, 0, sizeof(Connection)); KineticAllocator_NewConnection_ExpectAndReturn(&Connection); KineticStatus status = KineticSession_Create(&Session, &Client); Loading Loading @@ -100,22 +100,6 @@ void test_KineticSession_Create_should_allocate_and_destroy_KineticConnections(v TEST_ASSERT_NULL(session.connection); } void test_KINETIC_CONNECTION_INIT_should_create_a_default_connection_object(void) { LOG_LOCATION; KineticConnection connection; KINETIC_CONNECTION_INIT(&connection); TEST_ASSERT_FALSE(connection.connected); TEST_ASSERT_EQUAL(0, connection.session.config.port); TEST_ASSERT_EQUAL(-1, connection.socket); TEST_ASSERT_EQUAL_INT64(0, connection.sequence); TEST_ASSERT_EQUAL_INT64(0, connection.connectionID); TEST_ASSERT_EQUAL_STRING("", connection.session.config.host); TEST_ASSERT_EQUAL_INT64(0, connection.session.config.clusterVersion); TEST_ASSERT_EQUAL_INT64(0, connection.session.config.identity); } void test_KineticSession_Connect_should_return_KINETIC_SESSION_EMPTY_upon_NULL_session(void) { LOG_LOCATION; Loading Loading @@ -201,9 +185,6 @@ void test_KineticSession_Connect_should_connect_to_specified_host(void) bus_register_socket_ExpectAndReturn(NULL, BUS_SOCKET_PLAIN, expectedConnection.socket, &actualConnection, true); // Setup mock expectations for worker thread KineticSocket_WaitUntilDataAvailable_IgnoreAndReturn(KINETIC_WAIT_STATUS_TIMED_OUT); // Establish connection KineticStatus status = KineticSession_Connect(&session); Loading Loading
src/lib/kinetic_allocator.c +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ KineticConnection* KineticAllocator_NewConnection(void) LOG0("Failed allocating new Connection!"); return NULL; } connection->socket = -1; // start without a file descriptor return connection; } Loading
test/unit/test_kinetic_allocator.c +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ void test_KineticAllocator_NewConnection_should_return_a_connection_with_connect TEST_ASSERT_FALSE(connection->connected); } void test_KineticAllocator_NewConnection_should_return_a_connection_with_a_minus1_fd(void) { calloc_ExpectAndReturn(1, sizeof(KineticConnection), &Connection); KineticConnection* connection = KineticAllocator_NewConnection(); TEST_ASSERT_NOT_NULL(connection); TEST_ASSERT_EQUAL(-1, connection->socket); } void test_KineticAllocator_NewKineticResponse_should_return_null_if_calloc_return_null(void) { calloc_ExpectAndReturn(1, sizeof(KineticResponse) + 1234, NULL); Loading
test/unit/test_kinetic_session.c +1 −20 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ void setUp(void) .host = "somehost.com", .port = 17, }; KINETIC_CONNECTION_INIT(&Connection); memset(&Connection, 0, sizeof(Connection)); KineticAllocator_NewConnection_ExpectAndReturn(&Connection); KineticStatus status = KineticSession_Create(&Session, &Client); Loading Loading @@ -100,22 +100,6 @@ void test_KineticSession_Create_should_allocate_and_destroy_KineticConnections(v TEST_ASSERT_NULL(session.connection); } void test_KINETIC_CONNECTION_INIT_should_create_a_default_connection_object(void) { LOG_LOCATION; KineticConnection connection; KINETIC_CONNECTION_INIT(&connection); TEST_ASSERT_FALSE(connection.connected); TEST_ASSERT_EQUAL(0, connection.session.config.port); TEST_ASSERT_EQUAL(-1, connection.socket); TEST_ASSERT_EQUAL_INT64(0, connection.sequence); TEST_ASSERT_EQUAL_INT64(0, connection.connectionID); TEST_ASSERT_EQUAL_STRING("", connection.session.config.host); TEST_ASSERT_EQUAL_INT64(0, connection.session.config.clusterVersion); TEST_ASSERT_EQUAL_INT64(0, connection.session.config.identity); } void test_KineticSession_Connect_should_return_KINETIC_SESSION_EMPTY_upon_NULL_session(void) { LOG_LOCATION; Loading Loading @@ -201,9 +185,6 @@ void test_KineticSession_Connect_should_connect_to_specified_host(void) bus_register_socket_ExpectAndReturn(NULL, BUS_SOCKET_PLAIN, expectedConnection.socket, &actualConnection, true); // Setup mock expectations for worker thread KineticSocket_WaitUntilDataAvailable_IgnoreAndReturn(KINETIC_WAIT_STATUS_TIMED_OUT); // Establish connection KineticStatus status = KineticSession_Connect(&session); Loading