Skip to content
Snippets Groups Projects
Commit 0ea4a01c authored by thodkatz's avatar thodkatz
Browse files

Add tests for ST[01]

parent 4d101054
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,9 @@ add_executable(ecss_services src/main.cpp src/Message.cpp src/Service.cpp
IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt")
add_subdirectory(lib/Catch2)
add_executable(tests src/Message.cpp src/Services/TestService.cpp test/tests.cpp
test/Message.cpp test/TestPlatform.cpp test/Services/TestService.cpp)
add_executable(tests src/Message.cpp src/Services/TestService.cpp
src/Services/RequestVerificationService.cpp test/tests.cpp
test/Message.cpp test/TestPlatform.cpp test/Services/TestService.cpp
test/Services/RequestVerificationService.cpp)
target_link_libraries(tests Catch2::Catch2)
ENDIF ()
#include <catch2/catch.hpp>
#include <Services/RequestVerificationService.hpp>
#include <Message.hpp>
#include "ServiceTests.hpp"
TEST_CASE("TM[1,1]", "[service][st01]") {
RequestVerificationService reqVerifService;
reqVerifService.successAcceptanceVerification(Message::TC, true, 2, 2, 10);
REQUIRE(ServiceTests::hasOneMessage());
Message response = ServiceTests::get(0);
// Checks for the class-members of the object response
CHECK(response.serviceType == 1);
CHECK(response.messageType == 1);
CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1)
CHECK(response.applicationId == 0);
REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array
// Check for the value that is stored in data array(member-class of object response)
CHECK(response.readEnumerated(3) == 2); // packet version number
CHECK(response.readEnumerated(1) == 1); // packet type
CHECK(response.readBits(1) == true); // secondary header flag
CHECK(response.readEnumerated(11) == 2); // application process ID
CHECK(response.readEnumerated(2) == 2); // sequence flags
CHECK(response.readBits(14) == 10); // packet sequence count
}
TEST_CASE("TM[1,2]", "[service][st01]") {
RequestVerificationService reqVerifService;
reqVerifService.failAcceptanceVerification(Message::TC, true, 2, 2, 10, 5);
REQUIRE(ServiceTests::hasOneMessage());
Message response = ServiceTests::get(0);
// Checks for the class-members of the object response
CHECK(response.serviceType == 1);
CHECK(response.messageType == 2);
CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1)
CHECK(response.applicationId == 0);
REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array
// Check for the value that is stored in data array(member-class of object response)
CHECK(response.readEnumerated(3) == 2); // packet version number
CHECK(response.readEnumerated(1) == 1); // packet type
CHECK(response.readBits(1) == true); // secondary header flag
CHECK(response.readEnumerated(11) == 2); // application process ID
CHECK(response.readEnumerated(2) == 2); // sequence flags
CHECK(response.readBits(14) == 10); // packet sequence count
CHECK(response.readEnum16() == 5); // error code
}
TEST_CASE("TM[1,7]", "[service][st01]") {
RequestVerificationService reqVerifService;
reqVerifService.successExecutionVerification(Message::TC, true, 2, 2, 10);
REQUIRE(ServiceTests::hasOneMessage());
Message response = ServiceTests::get(0);
// Checks for the class-members of the object response
CHECK(response.serviceType == 1);
CHECK(response.messageType == 7);
CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1)
CHECK(response.applicationId == 0);
REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array
// Check for the value that is stored in data array(member-class of object response)
CHECK(response.readEnumerated(3) == 2); // packet version number
CHECK(response.readEnumerated(1) == 1); // packet type
CHECK(response.readBits(1) == true); // secondary header flag
CHECK(response.readEnumerated(11) == 2); // application process ID
CHECK(response.readEnumerated(2) == 2); // sequence flags
CHECK(response.readBits(14) == 10); // packet sequence count
}
TEST_CASE("TM[1,8]", "[service][st01]") {
RequestVerificationService reqVerifService;
reqVerifService.failExecutionVerification(Message::TC, true, 2, 2, 10, 6);
REQUIRE(ServiceTests::hasOneMessage());
Message response = ServiceTests::get(0);
// Checks for the class-members of the object response
CHECK(response.serviceType == 1);
CHECK(response.messageType == 8);
CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1)
CHECK(response.applicationId == 0);
REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array
// Check for the value that is stored in data array(member-class of object response)
CHECK(response.readEnumerated(3) == 2); // packet version number
CHECK(response.readEnumerated(1) == 1); // packet type
CHECK(response.readBits(1) == true); // secondary header flag
CHECK(response.readEnumerated(11) == 2); // application process ID
CHECK(response.readEnumerated(2) == 2); // sequence flags
CHECK(response.readBits(14) == 10); // packet sequence count
CHECK(response.readEnum16() == 6); // error code
}
TEST_CASE("TM[1,10]", "[service][st01]") {
RequestVerificationService reqVerifService;
reqVerifService.failRoutingVerification(Message::TC, true, 2, 2, 10, 7);
REQUIRE(ServiceTests::hasOneMessage());
Message response = ServiceTests::get(0);
// Checks for the class-members of the object response
CHECK(response.serviceType == 1);
CHECK(response.messageType == 10);
CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1)
CHECK(response.applicationId == 0);
REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array
// Check for the value that is stored in data array(member-class of object response)
CHECK(response.readEnumerated(3) == 2); // packet version number
CHECK(response.readEnumerated(1) == 1); // packet type
CHECK(response.readBits(1) == true); // secondary header flag
CHECK(response.readEnumerated(11) == 2); // application process ID
CHECK(response.readEnumerated(2) == 2); // sequence flags
CHECK(response.readBits(14) == 10); // packet sequence count
CHECK(response.readEnum16() == 7); // error code
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment