diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..59fd7dc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +name: CI/CD + +on: [push] + +jobs: + code-tests: + strategy: + matrix: + platform: [x86, x64] + os: [ubuntu-latest] + runs-on: '${{ matrix.os }}' + name: 'Test: ${{ matrix.os }} / ${{ matrix.platform }}' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up GCC + uses: ./ + with: + platform: '${{ matrix.platform }}' + cc: 1 + - name: tests + run: | + chmod +x ./tests/test.sh + ./tests/test.sh \ No newline at end of file diff --git a/Utils/TestUtils.h b/Utils/TestUtils.h index ce85828..29d7fd6 100644 --- a/Utils/TestUtils.h +++ b/Utils/TestUtils.h @@ -19,7 +19,7 @@ if (_a == _b) { \ printf("."); \ } else { \ - printf("F"); \ + printf("[F]"); \ printf("\n\n%s - %i: ", __FILE__, __LINE__); \ printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \ return 0; } \ @@ -28,10 +28,12 @@ #define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) \ ({ __typeof__ (a) _a = (a); \ __typeof__ (b) _b = (b); \ - if (oms_abs(_a - _b) <= delta) { \ + __typeof__ (delta) _delta = (delta); \ + __typeof__ (delta) _d = (_a - _b); \ + if (oms_abs(_d) <= _delta) { \ printf("."); \ } else { \ - printf("F"); \ + printf("[F]"); \ printf("\n\n%s - %i: ", __FILE__, __LINE__); \ printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \ return 0; } \ diff --git a/tests/Image/ImageUtilsTest.cpp b/tests/Image/ImageUtilsTest.cpp index b1661fa..95b9d8e 100644 --- a/tests/Image/ImageUtilsTest.cpp +++ b/tests/Image/ImageUtilsTest.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) ASSERT_EQUALS(black, 0.0, "%f", "%f"); float other = Image::ImageUtils::lightnessFromRgb(125, 125, 125); - ASSERT_EQUALS_WITH_DELTA(other, 0.524, 0.001, "%f", "%f"); + ASSERT_EQUALS_WITH_DELTA(other, 0.524, 0.01, "%f", "%f"); printf("\n\n"); diff --git a/tests/test.sh b/tests/test.sh index 974ca29..7f213b1 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,3 +1,5 @@ #!/bin/bash -g++ Image/ImageUtilsTest.cpp -o Image/ImageUtilsTest && ./Image/ImageUtilsTest && rm Image/ImageUtilsTest \ No newline at end of file +BASEDIR=$(dirname "$(readlink -f "$0")") + +g++ $BASEDIR/Image/ImageUtilsTest.cpp -o $BASEDIR/Image/ImageUtilsTest && $BASEDIR/Image/ImageUtilsTest && rm $BASEDIR/Image/ImageUtilsTest \ No newline at end of file