Skip to content

Commit

Permalink
Merge pull request #8 from nfdi4plants/setupTests
Browse files Browse the repository at this point in the history
Setup tests
  • Loading branch information
HLWeil authored Apr 3, 2023
2 parents e84dd8f + 4145f8d commit 9625b91
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: dotnet run --project ./build/Build.fsproj runtests
14 changes: 14 additions & 0 deletions arcIO.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/ProjectInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions build/TestTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestMinor"
}
}
10 changes: 7 additions & 3 deletions src/arcIO.NET/Converter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Workbook>)
| ARCtoTSV of (QInvestigation -> QStudy -> QAssay -> SheetEntity<Workbook>)
| ARCtoXLSX of (QInvestigation -> QStudy -> QAssay -> SheetEntity<Workbook>)
| ARCtoXML of (QInvestigation -> QStudy -> QAssay -> LitXml.XmlPart)
//| ARCtoJSON of QInvestigation -> QStudy -> QAssay ->
| ARCtoJSON of (QInvestigation -> QStudy -> QAssay -> JEntity<Nodes.JsonNode>)

member this.ConvertCSV(i,s,a) =
match this with
Expand All @@ -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"
3 changes: 2 additions & 1 deletion src/arcIO.NET/arcIO.NET.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ISADotNet.XLSX" Version="0.7.0-preview.8" />
<PackageReference Include="ISADotNet.XLSX" Version="0.7.0-preview.10" />
<PackageReference Include="JsonDSL" Version="0.0.5" />
<PackageReference Include="LitXml" Version="0.1.0" />
<PackageReference Include="NLog" Version="5.1.2" />
</ItemGroup>
Expand Down
16 changes: 16 additions & 0 deletions tests/arcIO.NET.Tests/AssayTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module AssayTests

open Expecto
open TestingUtils
open arcIO.NET
open System.Text.Json

[<Tests>]
let testComponentCasting =

testList "Test" [
testCase "WillFail" (fun () ->
Expect.isTrue true "Test if the test will test."

)
]
11 changes: 11 additions & 0 deletions tests/arcIO.NET.Tests/Main.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module arcIO.NET.Tests

open Expecto

[<EntryPoint>]
let main argv =

//Regex Test
Tests.runTestsWithCLIArgs [Tests.CLIArguments.Sequenced] argv AssayTests.testComponentCasting |> ignore

0
16 changes: 16 additions & 0 deletions tests/arcIO.NET.Tests/Utils.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module TestingUtils

open Expecto

///
let floatsClose accuracy (seq1:seq<float>) (seq2:seq<float>) =
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
29 changes: 29 additions & 0 deletions tests/arcIO.NET.Tests/arcIO.NET.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Remove="ISADotNet.Validation\**" />
<EmbeddedResource Remove="ISADotNet.XLSX\**" />
</ItemGroup>

<ItemGroup>
<Compile Include="Utils.fs" />
<Compile Include="AssayTests.fs" />
<Compile Include="Main.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Expecto" Version="9.*" />
<PackageReference Include="FSharp.Data" Version="5.0.2" />
<PackageReference Include="NJsonSchema" Version="10.8.0" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<ProjectReference Include="..\..\src\arcIO.NET\arcIO.NET.fsproj" />
<PackageReference Update="FSharp.Core" Version="7.0.300-beta.23127.2" />
</ItemGroup>
</Project>

0 comments on commit 9625b91

Please sign in to comment.