Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CPPBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/CPPTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
26 changes: 16 additions & 10 deletions Sources/Tests/CPPWrapperUnitTests/tests/RunTests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <AngouriMath.h>
#include <gtest/gtest.h>
#include <vector>
#include <string>

TEST(RunTests, ParsingTest1) {
auto src = "x / 2 + 3";
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<WarningsAsErrors />
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PublishAot>true</PublishAot>
</PropertyGroup>

<Target Name="Copy for Windows" Condition="$([MSBuild]::IsOSPlatform('Windows'))" AfterTargets="Publish">
Expand All @@ -19,6 +20,8 @@

<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="AngouriMath" Version="1.4.0-preview.2" />
<ProjectReference Include="..\..\AngouriMath\AngouriMath.csproj">
<SetTargetFramework>TargetFramework=net10.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>
</Project>
Loading