This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.10.2) | |
| project("GitLab Runner Demo" | |
| DESCRIPTION "Demonstrate GitLab Runner" | |
| LANGUAGES CXX) | |
| add_executable(HelloWorld ${CMAKE_SOURCE_DIR}/hello_world.cpp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh_build_and_run: | |
| stage: build | |
| tags: | |
| - ssh | |
| script: | |
| - g++ hello_world.cpp -o HelloWorld | |
| - ./HelloWorld | |
| artifacts: | |
| paths: | |
| - build/HelloWorld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x86_aarch64_build: | |
| stage: build | |
| tags: | |
| - x86-aarch64 | |
| script: | |
| - aarch64-linux-gnu-g++ hello_world.cpp -o HelloWorld | |
| artifacts: | |
| paths: | |
| - HelloWorld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker_x86_build: | |
| stage: build | |
| tags: | |
| - x86 | |
| - docker | |
| before_script: | |
| - apt-get update && apt-get upgrade -y | |
| - apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y | |
| script: | |
| - aarch64-linux-gnu-g++ hello_world.cpp -o HelloWorld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: unittest.hpp | |
| #define DeclareTest(Module, TestName) \ | |
| class Test_##Module##_##TestName: public UnitTest \ | |
| { \ | |
| Test_##Module##_##TestName(): UnitTest(){} \ | |
| public: \ | |
| static Test_##Module##_##TestName* getInstance() \ | |
| { \ | |
| static Test_##Module##_##TestName testClass; \ | |
| return &testClass; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: testcase.hpp | |
| #include "unittest.hpp" | |
| DeclareTest(dummy, dummycase) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: testcase.cpp | |
| #include "testcase.hpp" | |
| DefineTest(dummy, dummycase){ | |
| // Write your test code here | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: unittest.hpp | |
| class UnitTest { | |
| protected: | |
| UnitTest() {} | |
| public: | |
| bool isTrue{true}; | |
| static std::list<UnitTest*> testList; | |
| virtual ~UnitTest() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: unitest.cpp | |
| void UnitTest::runTests() | |
| { | |
| // Variables to track passed and failed tests | |
| int passed{0}; | |
| int failed{0}; | |
| if(testList.empty()) { | |
| std::cout << "No tests registered!!" << std::endl; | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // File: unittest.hpp | |
| #define RegisterTest(Module, TestName) \ | |
| UnitTest::getInstance().testList.push_back( \ | |
| Test_##Module##_##TestName::getInstance()); | |
| #define RunTests() \ | |
| UnitTest::getInstance().runTests(); | |
| #define ExpectEQ(arg1, arg2) \ | |
| isTrue &= expectEQ(arg1, arg2); |