diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-08-24 00:21:07 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-08-24 00:21:07 +0100 |
commit | 5403490b941f7c031bf1aafdb91b1098f69edbf2 (patch) | |
tree | 18cd2deb0c30b38d8ca7c5305735d2323259e020 /test | |
parent | 2dbcbe3575134b3c6267b1a396b57080067ed9da (diff) | |
download | YAGE-5403490b941f7c031bf1aafdb91b1098f69edbf2.tar.gz YAGE-5403490b941f7c031bf1aafdb91b1098f69edbf2.zip |
Running clang-format over everything.
Edited formatting and ran it over all the files.
Diffstat (limited to 'test')
-rw-r--r-- | test/matrixtest.cpp | 25 | ||||
-rw-r--r-- | test/particlebodytest.cpp | 9 | ||||
-rw-r--r-- | test/windowtest.cpp | 11 | ||||
-rw-r--r-- | test/yagetest.cpp | 11 |
4 files changed, 32 insertions, 24 deletions
diff --git a/test/matrixtest.cpp b/test/matrixtest.cpp index 1b27b544..d388948b 100644 --- a/test/matrixtest.cpp +++ b/test/matrixtest.cpp @@ -16,7 +16,8 @@ #include "gtest/gtest.h" template <int Size> -int matrixAssign(int number, int i, int j) { +int matrixAssign(int number, int i, int j) +{ yage::Matrix<Size, Size, int> m; m[j][i] = number; @@ -24,7 +25,8 @@ int matrixAssign(int number, int i, int j) { } template <int Size> -int matrixAddition(int num1, int num2) { +int matrixAddition(int num1, int num2) +{ yage::Matrix<Size, Size, int> m1, m2; m1[1][1] = num1; m2[1][1] = num2; @@ -34,8 +36,9 @@ int matrixAddition(int num1, int num2) { return m3[1][1]; } -int vectorDotProduct(const std::vector<int>& vec_contents_f, - const std::vector<int>& vec_contents_s) { +int vectorDotProduct(const std::vector<int> &vec_contents_f, + const std::vector<int> &vec_contents_s) +{ yage::Vector<3, int> v1(vec_contents_f); yage::Vector<3, int> v2(vec_contents_s); @@ -48,28 +51,32 @@ bool matrixMultiplication() { return false; } // TESTS -TEST(Matrix, Assign) { +TEST(Matrix, Assign) +{ int rand_num = rand(); ASSERT_EQ(rand_num, matrixAssign<10>(rand_num, 4, 2)); } -TEST(Matrix, Addition) { +TEST(Matrix, Addition) +{ int rand_x = rand(); int rand_y = rand(); ASSERT_EQ(rand_x + rand_y, matrixAddition<10>(rand_x, rand_y)); } -TEST(Vector, DotProduct) { +TEST(Vector, DotProduct) +{ std::vector<int> contents_i = {rand() % 100, rand() % 100, rand() % 100}; std::vector<int> contents_j = {rand() % 100, rand() % 100, rand() % 100}; int sum = 0; - for(std::size_t i = 0; i < contents_i.size(); ++i) { + for (std::size_t i = 0; i < contents_i.size(); ++i) { sum += contents_i[i] * contents_j[i]; } ASSERT_EQ(sum, vectorDotProduct(contents_i, contents_j)); } -int main(int argc, char** argv) { +int main(int argc, char **argv) +{ srand(static_cast<unsigned>(time(nullptr))); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/test/particlebodytest.cpp b/test/particlebodytest.cpp index 5c915a9a..65c3885c 100644 --- a/test/particlebodytest.cpp +++ b/test/particlebodytest.cpp @@ -12,7 +12,8 @@ #include "Physics/particlebody.hpp" #include "gtest/gtest.h" -double gravityAcceleration(int iterations) { +double gravityAcceleration(int iterations) +{ yage::ParticleBody body; for (int i = 0; i < 60 * iterations; ++i) { body.update(); @@ -23,7 +24,8 @@ double gravityAcceleration(int iterations) { // Tests -TEST(ParticleBody, Gravity) { +TEST(ParticleBody, Gravity) +{ int randomItr = rand() % 10; double idealPosition = 0.5 * -9.81 * std::pow(randomItr, 2); @@ -31,7 +33,8 @@ TEST(ParticleBody, Gravity) { ASSERT_LE(idealPosition * 1.05, gravityAcceleration(randomItr)); } -int main(int argc, char** argv) { +int main(int argc, char **argv) +{ testing::InitGoogleTest(&argc, argv); srand(static_cast<unsigned>(time(nullptr))); return RUN_ALL_TESTS(); diff --git a/test/windowtest.cpp b/test/windowtest.cpp index 6fb4e462..73e2f82c 100644 --- a/test/windowtest.cpp +++ b/test/windowtest.cpp @@ -10,11 +10,10 @@ #include "yage.hpp" -TEST(Window, Open) { - ASSERT_TRUE(true); -} +TEST(Window, Open) { ASSERT_TRUE(true); } -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } diff --git a/test/yagetest.cpp b/test/yagetest.cpp index 8ca6c83e..90d915a8 100644 --- a/test/yagetest.cpp +++ b/test/yagetest.cpp @@ -10,11 +10,10 @@ #include "yage.hpp" -TEST(YAGE, InitQuit) { - ASSERT_TRUE(true); -} +TEST(YAGE, InitQuit) { ASSERT_TRUE(true); } -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } |