mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-02-12 16:38:41 +00:00
setup c++ tests
This commit is contained in:
parent
1b90610d62
commit
d90fede2e1
24
.github/workflows/main.yml
vendored
Normal file
24
.github/workflows/main.yml
vendored
Normal file
|
|
@ -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
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
if (_a == _b) { \
|
if (_a == _b) { \
|
||||||
printf("."); \
|
printf("."); \
|
||||||
} else { \
|
} else { \
|
||||||
printf("F"); \
|
printf("[F]"); \
|
||||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||||
return 0; } \
|
return 0; } \
|
||||||
|
|
@ -28,10 +28,12 @@
|
||||||
#define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) \
|
#define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) \
|
||||||
({ __typeof__ (a) _a = (a); \
|
({ __typeof__ (a) _a = (a); \
|
||||||
__typeof__ (b) _b = (b); \
|
__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("."); \
|
printf("."); \
|
||||||
} else { \
|
} else { \
|
||||||
printf("F"); \
|
printf("[F]"); \
|
||||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||||
return 0; } \
|
return 0; } \
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int main(int argc, char** argv)
|
||||||
ASSERT_EQUALS(black, 0.0, "%f", "%f");
|
ASSERT_EQUALS(black, 0.0, "%f", "%f");
|
||||||
|
|
||||||
float other = Image::ImageUtils::lightnessFromRgb(125, 125, 125);
|
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");
|
printf("\n\n");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
g++ Image/ImageUtilsTest.cpp -o Image/ImageUtilsTest && ./Image/ImageUtilsTest && rm Image/ImageUtilsTest
|
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
|
||||||
|
g++ $BASEDIR/Image/ImageUtilsTest.cpp -o $BASEDIR/Image/ImageUtilsTest && $BASEDIR/Image/ImageUtilsTest && rm $BASEDIR/Image/ImageUtilsTest
|
||||||
Loading…
Reference in New Issue
Block a user