diff --git a/.github/workflows/CPPBuild.yml b/.github/workflows/CPPBuild.yml index cf26d23e9..9d570ae91 100644 --- a/.github/workflows/CPPBuild.yml +++ b/.github/workflows/CPPBuild.yml @@ -55,14 +55,14 @@ jobs: cd Sources/Wrappers/AngouriMath.CPP.Exporting mkdir ../AngouriMath.CPP.Importing/out-x64 call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - dotnet publish -p:NativeLib=Shared -p:SelfContained=true -p:PublishAot=true -r ${{ matrix.flag }} -c release + dotnet publish -p:NativeLib=Shared -p:SelfContained=true -r ${{ matrix.flag }} -c release - name: 'Building the library into native for Linux & MacOS' if: ${{ matrix.os != 'windows-latest' }} run: | cd Sources/Wrappers/AngouriMath.CPP.Exporting mkdir ../AngouriMath.CPP.Importing/out-x64 - dotnet publish -p:NativeLib=Shared -p:SelfContained=true -p:PublishAot=true -r ${{ matrix.flag }} -c release + dotnet publish -p:NativeLib=Shared -p:SelfContained=true -r ${{ matrix.flag }} -c release - name: 'Renaming the library for Linux' if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/.github/workflows/CPPTest.yml b/.github/workflows/CPPTest.yml index 351f8e7d6..47820ae58 100644 --- a/.github/workflows/CPPTest.yml +++ b/.github/workflows/CPPTest.yml @@ -47,14 +47,14 @@ jobs: cd Sources/Wrappers/AngouriMath.CPP.Exporting mkdir ../AngouriMath.CPP.Importing/out-x64 call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - dotnet publish -p:NativeLib=Shared -p:SelfContained=true -p:PublishAot=true -r ${{ matrix.flag }} -c release + dotnet publish -p:NativeLib=Shared -p:SelfContained=true -r ${{ matrix.flag }} -c release - name: 'Building the library into native for Linux & MacOS' if: ${{ matrix.os != 'windows-latest' }} run: | cd Sources/Wrappers/AngouriMath.CPP.Exporting mkdir ../AngouriMath.CPP.Importing/out-x64 - dotnet publish -p:NativeLib=Shared -p:SelfContained=true -p:PublishAot=true -r ${{ matrix.flag }} -c release + dotnet publish -p:NativeLib=Shared -p:SelfContained=true -r ${{ matrix.flag }} -c release - name: 'Preparing tests' run: | diff --git a/Sources/Tests/CPPWrapperUnitTests/tests/RunTests.cpp b/Sources/Tests/CPPWrapperUnitTests/tests/RunTests.cpp index ad0300592..61ea0e60d 100644 --- a/Sources/Tests/CPPWrapperUnitTests/tests/RunTests.cpp +++ b/Sources/Tests/CPPWrapperUnitTests/tests/RunTests.cpp @@ -1,6 +1,7 @@ #include #include #include +#include TEST(RunTests, ParsingTest1) { auto src = "x / 2 + 3"; @@ -54,20 +55,25 @@ TEST(RunTests, DiffTest2) { EXPECT_EQ(expected.ToString(), actual.ToString()); } +// An antiderivative is checked by differentiating it back, not by comparing its printed +// form. These two compared against the literals "x2 / 2" and "x2 / 2 + 2x", which do not +// say what they look like -- "x2" parses as a variable of that name rather than as a +// square -- and which could not survive Integrate gaining its constant of integration. +// The printed form is not the property under test: d/dx of the answer is. +static void ExpectAntiderivative(const char* integrand) { + AngouriMath::Entity entity = integrand; + auto back = entity.Integrate("x").Differentiate("x"); + auto difference = AngouriMath::Entity( + "(" + back.ToString() + ") - (" + std::string(integrand) + ")"); + EXPECT_EQ("0", difference.Simplify().ToString()); +} + TEST(RunTests, IntTest1) { - auto src = "x"; - AngouriMath::Entity entity = src; - auto actual = entity.Integrate("x"); - auto expected = AngouriMath::Entity("x2 / 2"); - EXPECT_EQ(expected.ToString(), actual.ToString()); + ExpectAntiderivative("x"); } TEST(RunTests, IntTest2) { - auto src = "x + 2"; - AngouriMath::Entity entity = src; - auto actual = entity.Integrate("x"); - auto expected = AngouriMath::Entity("x2 / 2 + 2x"); - EXPECT_EQ(expected.ToString(), actual.ToString()); + ExpectAntiderivative("x + 2"); } TEST(RunTests, LimTest1) { diff --git a/Sources/Wrappers/AngouriMath.CPP.Exporting/AngouriMath.CPP.Exporting.csproj b/Sources/Wrappers/AngouriMath.CPP.Exporting/AngouriMath.CPP.Exporting.csproj index 8c8cbdd96..3288a2805 100644 --- a/Sources/Wrappers/AngouriMath.CPP.Exporting/AngouriMath.CPP.Exporting.csproj +++ b/Sources/Wrappers/AngouriMath.CPP.Exporting/AngouriMath.CPP.Exporting.csproj @@ -6,6 +6,7 @@ true true + true @@ -19,6 +20,8 @@ - + + TargetFramework=net10.0 + \ No newline at end of file