CI: the tests in both coordinate types, on GCC, Clang and MSVC
Every job builds test_onlay.c with warnings as errors, once with float coordinates and once with int16_t, and runs it. The test now uses snprintf and casts what it passes as lay_scalar, which MSVC's /W4 asked for. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f2416fd056
commit
1c20828e69
@@ -0,0 +1,50 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
unix:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { name: linux gcc, runner: ubuntu-24.04, cc: gcc }
|
||||
- { name: linux clang, runner: ubuntu-24.04, cc: clang }
|
||||
- { name: macos clang, runner: macos-15, cc: clang }
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Float coordinates
|
||||
run: |
|
||||
${{ matrix.cc }} -std=c99 -Wall -Wextra -Werror -DLAY_FLOAT=1 -o test_float test_onlay.c onlay.c
|
||||
./test_float
|
||||
- name: int16_t coordinates
|
||||
run: |
|
||||
${{ matrix.cc }} -std=c99 -Wall -Wextra -Werror -o test_int test_onlay.c onlay.c
|
||||
./test_int
|
||||
|
||||
windows:
|
||||
name: windows msvc
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Float and int16_t coordinates
|
||||
shell: cmd
|
||||
run: |
|
||||
for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cl /nologo /W4 /WX /DLAY_FLOAT=1 /Fe:test_float.exe test_onlay.c onlay.c || exit /b 1
|
||||
test_float.exe || exit /b 1
|
||||
cl /nologo /W4 /WX /Fe:test_int.exe test_onlay.c onlay.c || exit /b 1
|
||||
test_int.exe
|
||||
+7
-7
@@ -114,9 +114,9 @@ test_weighted_columns(void)
|
||||
for (i = 0; i < n; i++) {
|
||||
lay_vec4 r = lay_get_rect(&ctx, kid[i]);
|
||||
char label[32];
|
||||
sprintf(label, "%.0f%% width", (double)(cols[i].w * 100.0f));
|
||||
snprintf(label, sizeof label, "%.0f%% width", (double)(cols[i].w * 100.0f));
|
||||
check(label, (int)r.v[2], cols[i].expect_w);
|
||||
sprintf(label, "%.0f%% x", (double)(cols[i].w * 100.0f));
|
||||
snprintf(label, sizeof label, "%.0f%% x", (double)(cols[i].w * 100.0f));
|
||||
check(label, (int)r.v[0], cols[i].expect_x);
|
||||
}
|
||||
lay_destroy_context(&ctx);
|
||||
@@ -183,16 +183,16 @@ test_template_rows(void)
|
||||
lay_reserve_items_capacity(&ctx, 32);
|
||||
|
||||
page = lay_item(&ctx);
|
||||
lay_set_size_xy(&ctx, page, W, 200);
|
||||
lay_set_size_xy(&ctx, page, (lay_scalar)W, 200);
|
||||
lay_set_contain(&ctx, page, LAY_COLUMN | LAY_START);
|
||||
lay_set_gap(&ctx, page, ROW_GAP2);
|
||||
lay_set_gap(&ctx, page, (lay_scalar)ROW_GAP2);
|
||||
|
||||
for (r = 0; r < ROWS; r++) {
|
||||
row = lay_item(&ctx);
|
||||
lay_set_behave(&ctx, row, LAY_HFILL);
|
||||
lay_set_size_xy(&ctx, row, 0, 30);
|
||||
lay_set_contain(&ctx, row, LAY_ROW | LAY_START);
|
||||
lay_set_gap(&ctx, row, COL_GAP);
|
||||
lay_set_gap(&ctx, row, (lay_scalar)COL_GAP);
|
||||
lay_insert(&ctx, page, row);
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
@@ -213,9 +213,9 @@ test_template_rows(void)
|
||||
for (c = 0; c < 3; c++) {
|
||||
lay_vec4 q = lay_get_rect(&ctx, cell[r][c]);
|
||||
char label[40];
|
||||
sprintf(label, "row %d col %d x", r, c);
|
||||
snprintf(label, sizeof label, "row %d col %d x", r, c);
|
||||
check(label, (int)q.v[0], (int)want_x[c]);
|
||||
sprintf(label, "row %d col %d w", r, c);
|
||||
snprintf(label, sizeof label, "row %d col %d w", r, c);
|
||||
check(label, (int)q.v[2], (int)want_w[c]);
|
||||
}
|
||||
lay_destroy_context(&ctx);
|
||||
|
||||
Reference in New Issue
Block a user