From 6d002cd35de3b94a8f588fd13295d1599dbda3b9 Mon Sep 17 00:00:00 2001 From: siwatanejo <7511840+siwatanejo@users.noreply.github.com> Date: Sun, 10 Mar 2024 18:38:25 +0100 Subject: [PATCH] Integration tests against LDK bindings --- .github/workflows/CI.yml | 13 ++++++++++ Directory.Packages.props | 6 +++++ PackWallet.sln | 7 ++++++ .../LdkInterop.cs | 25 +++++++++++++++++++ .../PackWallet.Tests.Integration.csproj | 21 ++++++++++++++++ src/PackWallet.Tests.Integration/Usings.cs | 1 + 6 files changed, 73 insertions(+) create mode 100644 src/PackWallet.Tests.Integration/LdkInterop.cs create mode 100644 src/PackWallet.Tests.Integration/PackWallet.Tests.Integration.csproj create mode 100644 src/PackWallet.Tests.Integration/Usings.cs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index acd6d79..f47c282 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,6 +60,19 @@ jobs: with: name: snap path: ./*.snap + + integration_tests: + strategy: + matrix: + # macos-13 is x64 and macos-14 is arm64 + os: [ubuntu-22.04, macos-13, macos-14] + + needs: build + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Run Tests + run: dotnet test run_snap: needs: build_snap diff --git a/Directory.Packages.props b/Directory.Packages.props index 66eeba4..8118ac5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,5 +4,11 @@ + + + + + + diff --git a/PackWallet.sln b/PackWallet.sln index c70d03a..86e607e 100644 --- a/PackWallet.sln +++ b/PackWallet.sln @@ -1,7 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PackWallet", "src\PackWallet\PackWallet.fsproj", "{23AE2DF5-6284-404B-A583-05A02539B0DF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackWallet.Tests.Integration", "src\PackWallet.Tests.Integration\PackWallet.Tests.Integration.csproj", "{0A88324C-3B50-4851-A67F-FA084BDC6148}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +15,9 @@ Global {23AE2DF5-6284-404B-A583-05A02539B0DF}.Debug|Any CPU.Build.0 = Debug|Any CPU {23AE2DF5-6284-404B-A583-05A02539B0DF}.Release|Any CPU.ActiveCfg = Release|Any CPU {23AE2DF5-6284-404B-A583-05A02539B0DF}.Release|Any CPU.Build.0 = Release|Any CPU + {0A88324C-3B50-4851-A67F-FA084BDC6148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A88324C-3B50-4851-A67F-FA084BDC6148}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A88324C-3B50-4851-A67F-FA084BDC6148}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A88324C-3B50-4851-A67F-FA084BDC6148}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/PackWallet.Tests.Integration/LdkInterop.cs b/src/PackWallet.Tests.Integration/LdkInterop.cs new file mode 100644 index 0000000..78fbbf3 --- /dev/null +++ b/src/PackWallet.Tests.Integration/LdkInterop.cs @@ -0,0 +1,25 @@ +namespace PackWallet.Tests.Integration; + +using org.ldk.structs; + +class ConsoleLogger : LoggerInterface +{ + public void log(Record record) + { + // just don't throw + } +} + +public class LdkInterop +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void TestLoggerDoesntCrash() + { + Logger.new_impl(new ConsoleLogger()); + } +} diff --git a/src/PackWallet.Tests.Integration/PackWallet.Tests.Integration.csproj b/src/PackWallet.Tests.Integration/PackWallet.Tests.Integration.csproj new file mode 100644 index 0000000..f5266e6 --- /dev/null +++ b/src/PackWallet.Tests.Integration/PackWallet.Tests.Integration.csproj @@ -0,0 +1,21 @@ + + + + net7.0 + enable + enable + + false + true + + + + + + + + + + + + diff --git a/src/PackWallet.Tests.Integration/Usings.cs b/src/PackWallet.Tests.Integration/Usings.cs new file mode 100644 index 0000000..9a28bd8 --- /dev/null +++ b/src/PackWallet.Tests.Integration/Usings.cs @@ -0,0 +1 @@ +global using NUnit.Framework;