-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from gistrec/tests
Move tests to master branch
- Loading branch information
Showing
11 changed files
with
289 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: 2 | ||
jobs: | ||
gtest: | ||
working_directory: ~/root | ||
docker: | ||
- image: gcc:latest | ||
steps: | ||
- run: | ||
name: Downloading dependencies | ||
command: | | ||
apt-get update | ||
apt-get install -y cmake | ||
apt-get install -y libgtest-dev | ||
- run: | ||
name: Installing dependencies | ||
working_directory: /usr/src/gtest/ | ||
command: | | ||
cmake CMakeLists.txt | ||
make | ||
cp /usr/src/gtest/*.a /usr/lib | ||
- checkout | ||
- run: | ||
name: "Pull Submodules" | ||
command: | | ||
git submodule init | ||
git submodule update --recursive --remote | ||
- run: | ||
name: Building tests | ||
command: make gtests | ||
- run: | ||
name: Running tests | ||
command: ./GTests --gtest_filter=* | ||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- gtest: | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- develop | ||
- tests |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ x64/ | |
x86/ | ||
Debug/ | ||
Release/ | ||
FileBroadcaster | ||
packages/ |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
all: | ||
program: | ||
g++ src/Main.cpp \ | ||
-std=c++14 -pthread \ | ||
-Ilib/cxxopts/include \ | ||
-o FileBroadcaster | ||
|
||
gtests: | ||
g++ tests/Tests.cpp \ | ||
-std=c++14 -pthread \ | ||
-Ilib/cxxopts/include \ | ||
-lgtest \ | ||
-o GTests |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "../src/Utils.hpp" | ||
|
||
class BytesConverter : public ::testing::TestWithParam<std::tuple<size_t, int>> { | ||
public: | ||
size_t value; | ||
int count; | ||
|
||
protected: | ||
void SetUp() override { | ||
std::tie(value, count) = GetParam(); | ||
} | ||
}; | ||
|
||
INSTANTIATE_TEST_CASE_P( | ||
CombinationsTest, BytesConverter, | ||
::testing::Combine( | ||
::testing::Values(0U, 1U, 2U, 1000U, 65535U, 2147483647U), | ||
::testing::Values(4, 8, 16))); | ||
|
||
TEST_P(BytesConverter, getIntFromBytes) { | ||
char buffer[16] = { 0 }; | ||
|
||
Utils::writeBytesFromNumber(buffer, value, count); | ||
|
||
size_t result = Utils::getNumberFromBytes(buffer, count); | ||
|
||
EXPECT_EQ(result, value); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn" version="1.8.0" targetFramework="native" /> | ||
</packages> |
Oops, something went wrong.