From ab939cefdf213dfd5f12efe44be7641b52db3efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Mon, 21 Feb 2022 11:49:00 +0800 Subject: [PATCH] Update native-unit-test.yml (#10130) * Update native-unit-test.yml --- .github/workflows/native-unit-test.yml | 2 +- native/tests/unit-test/src/math_vertex_test.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/native-unit-test.yml b/.github/workflows/native-unit-test.yml index e5e520784c..c10b87c359 100644 --- a/.github/workflows/native-unit-test.yml +++ b/.github/workflows/native-unit-test.yml @@ -30,7 +30,7 @@ jobs: - name: Run Unit Tests shell: bash run: | - cmake -B tests/unit-test/build -S tests/unit-test -G"Visual Studio 16 2019" -A win32 + cmake -B tests/unit-test/build -S tests/unit-test cmake --build tests/unit-test/build --config Release ./tests/unit-test/build/src/Release/CocosTest.exe diff --git a/native/tests/unit-test/src/math_vertex_test.cpp b/native/tests/unit-test/src/math_vertex_test.cpp index 8d5e800b58..6074fc1d3b 100644 --- a/native/tests/unit-test/src/math_vertex_test.cpp +++ b/native/tests/unit-test/src/math_vertex_test.cpp @@ -27,12 +27,12 @@ THE SOFTWARE. #include "cocos/math/Vertex.h" #include "utils.h" #include -#include +#include TEST(mathVertexTest, test8) { // ccVertexLineToPolygon logLabel = "test the vertex ccVertexLineToPolygon function"; - cc::Vec2 points[4]; + std::array points; cc::Vec2 p1(1, 1); points[0] = p1; cc::Vec2 p2(10, 10); @@ -41,8 +41,8 @@ TEST(mathVertexTest, test8) { points[2] = p3; cc::Vec2 p4(20, 70); points[3] = p4; - cc::Vec2 outP[6]; - cc::ccVertexLineToPolygon(points, 1, outP, 0, 5); + std::array outP; + cc::ccVertexLineToPolygon(points.data(), 1, outP.data(), 0, points.size()); ExpectEq(IsEqualF(outP[5].x, -0.468942523) && IsEqualF(outP[5].y, -9.82652664), true); // ccVertexLineIntersect logLabel = "test the vertex ccVertexLineIntersect function"; @@ -52,3 +52,4 @@ TEST(mathVertexTest, test8) { } +