From aca980bef59e7b6b17b8376e83b5177cf3f442d1 Mon Sep 17 00:00:00 2001 From: Heinrich Lukas Weil Date: Tue, 28 Feb 2023 14:55:22 +0100 Subject: [PATCH 1/2] include json in converter --- src/arcIO.NET/Converter.fs | 10 +++++++--- src/arcIO.NET/arcIO.NET.fsproj | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/arcIO.NET/Converter.fs b/src/arcIO.NET/Converter.fs index 5f5e26b..69ebc5b 100644 --- a/src/arcIO.NET/Converter.fs +++ b/src/arcIO.NET/Converter.fs @@ -4,14 +4,15 @@ open ISADotNet open ISADotNet.QueryModel open FsSpreadsheet.DSL open LitXml - +open JsonDSL +open System.Text.Json type ARCconverter = | ARCtoCSV of (QInvestigation -> QStudy -> QAssay -> SheetEntity) | ARCtoTSV of (QInvestigation -> QStudy -> QAssay -> SheetEntity) | ARCtoXLSX of (QInvestigation -> QStudy -> QAssay -> SheetEntity) | ARCtoXML of (QInvestigation -> QStudy -> QAssay -> LitXml.XmlPart) -//| ARCtoJSON of QInvestigation -> QStudy -> QAssay -> +| ARCtoJSON of (QInvestigation -> QStudy -> QAssay -> JEntity) member this.ConvertCSV(i,s,a) = match this with @@ -33,4 +34,7 @@ type ARCconverter = | ARCtoXML f -> f i s a | _ -> failwith "could not convert to xml" - + member this.ConvertJsn(i,s,a) = + match this with + | ARCtoJSON f -> f i s a + | _ -> failwith "could not convert to xml" diff --git a/src/arcIO.NET/arcIO.NET.fsproj b/src/arcIO.NET/arcIO.NET.fsproj index 8fd5de0..82b3ef6 100644 --- a/src/arcIO.NET/arcIO.NET.fsproj +++ b/src/arcIO.NET/arcIO.NET.fsproj @@ -24,7 +24,8 @@ - + + From 4145f8dee6642bfef7384370750503a9d8a433a0 Mon Sep 17 00:00:00 2001 From: Heinrich Lukas Weil Date: Mon, 3 Apr 2023 10:49:40 +0200 Subject: [PATCH 2/2] setup test environmet pin dotnet version to 6.x.x update ISADotNet reference --- .github/workflows/build-test.yml | 4 +-- arcIO.NET.sln | 14 ++++++++++ build/ProjectInfo.fs | 2 +- build/TestTasks.fs | 1 + global.json | 6 ++++ src/arcIO.NET/arcIO.NET.fsproj | 4 +-- tests/arcIO.NET.Tests/AssayTests.fs | 16 +++++++++++ tests/arcIO.NET.Tests/Main.fs | 11 ++++++++ tests/arcIO.NET.Tests/Utils.fs | 16 +++++++++++ tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj | 29 ++++++++++++++++++++ 10 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 global.json create mode 100644 tests/arcIO.NET.Tests/AssayTests.fs create mode 100644 tests/arcIO.NET.Tests/Main.fs create mode 100644 tests/arcIO.NET.Tests/Utils.fs create mode 100644 tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 99b03e7..91dd342 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -16,6 +16,6 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.x.x + dotnet-version: 6.x.x - name: Build and test - run: dotnet run --project ./build/Build.fsproj \ No newline at end of file + run: dotnet run --project ./build/Build.fsproj runtests \ No newline at end of file diff --git a/arcIO.NET.sln b/arcIO.NET.sln index 898be84..5482eea 100644 --- a/arcIO.NET.sln +++ b/arcIO.NET.sln @@ -7,6 +7,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "arcIO.NET", "src\arcIO.NET\ EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Build", "build\Build.fsproj", "{E7F453CD-BCCA-42EF-96A2-C74B9A09A593}" EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "arcIO.NET.Tests", "tests\arcIO.NET.Tests\arcIO.NET.Tests.fsproj", "{71F0320C-879D-47FA-B665-B5BD1F467F76}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,18 @@ Global {E7F453CD-BCCA-42EF-96A2-C74B9A09A593}.Release|x64.Build.0 = Release|Any CPU {E7F453CD-BCCA-42EF-96A2-C74B9A09A593}.Release|x86.ActiveCfg = Release|Any CPU {E7F453CD-BCCA-42EF-96A2-C74B9A09A593}.Release|x86.Build.0 = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|x64.ActiveCfg = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|x64.Build.0 = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|x86.ActiveCfg = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Debug|x86.Build.0 = Debug|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|Any CPU.Build.0 = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|x64.ActiveCfg = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|x64.Build.0 = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|x86.ActiveCfg = Release|Any CPU + {71F0320C-879D-47FA-B665-B5BD1F467F76}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/ProjectInfo.fs b/build/ProjectInfo.fs index 4716fce..0956afc 100644 --- a/build/ProjectInfo.fs +++ b/build/ProjectInfo.fs @@ -6,7 +6,7 @@ let project = "arcIO.NET" let testProjects = [ - // add relative paths (from project root) to your testprojects here + "tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj" ] let solutionFile = $"{project}.sln" diff --git a/build/TestTasks.fs b/build/TestTasks.fs index 113f964..50a9ed9 100644 --- a/build/TestTasks.fs +++ b/build/TestTasks.fs @@ -7,6 +7,7 @@ open ProjectInfo open BasicTasks let runTests = BuildTask.create "RunTests" [clean; build] { + printfn $"Testprojectcount: {Seq.length testProjects}" testProjects |> Seq.iter (fun testProject -> Fake.DotNet.DotNet.test(fun testParams -> diff --git a/global.json b/global.json new file mode 100644 index 0000000..08fc58c --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "6.0.100", + "rollForward": "latestMinor" + } +} \ No newline at end of file diff --git a/src/arcIO.NET/arcIO.NET.fsproj b/src/arcIO.NET/arcIO.NET.fsproj index 82b3ef6..0a17987 100644 --- a/src/arcIO.NET/arcIO.NET.fsproj +++ b/src/arcIO.NET/arcIO.NET.fsproj @@ -24,8 +24,8 @@ - - + + diff --git a/tests/arcIO.NET.Tests/AssayTests.fs b/tests/arcIO.NET.Tests/AssayTests.fs new file mode 100644 index 0000000..4e208f8 --- /dev/null +++ b/tests/arcIO.NET.Tests/AssayTests.fs @@ -0,0 +1,16 @@ +module AssayTests + +open Expecto +open TestingUtils +open arcIO.NET +open System.Text.Json + +[] +let testComponentCasting = + + testList "Test" [ + testCase "WillFail" (fun () -> + Expect.isTrue true "Test if the test will test." + + ) + ] \ No newline at end of file diff --git a/tests/arcIO.NET.Tests/Main.fs b/tests/arcIO.NET.Tests/Main.fs new file mode 100644 index 0000000..1baf6e2 --- /dev/null +++ b/tests/arcIO.NET.Tests/Main.fs @@ -0,0 +1,11 @@ +module arcIO.NET.Tests + +open Expecto + +[] +let main argv = + + //Regex Test + Tests.runTestsWithCLIArgs [Tests.CLIArguments.Sequenced] argv AssayTests.testComponentCasting |> ignore + + 0 \ No newline at end of file diff --git a/tests/arcIO.NET.Tests/Utils.fs b/tests/arcIO.NET.Tests/Utils.fs new file mode 100644 index 0000000..c20bd01 --- /dev/null +++ b/tests/arcIO.NET.Tests/Utils.fs @@ -0,0 +1,16 @@ +module TestingUtils + +open Expecto + + /// +let floatsClose accuracy (seq1:seq) (seq2:seq) = + Seq.map2 (fun x1 x2 -> Accuracy.areClose accuracy x1 x2) seq1 seq2 + |> Seq.contains false + |> not + +module Result = + + let getMessage res = + match res with + | Ok m -> m + | Error m -> m \ No newline at end of file diff --git a/tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj b/tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj new file mode 100644 index 0000000..d8a74ea --- /dev/null +++ b/tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj @@ -0,0 +1,29 @@ + + + + Exe + net6.0 + false + + + + + + + + + + + + + + + + + + + + + + +