diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..41785ce --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "paket": { + "version": "8.0.0", + "commands": [ + "paket" + ] + }, + "fantomas": { + "version": "6.2.3", + "commands": [ + "fantomas" + ] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4231fbc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,50 @@ +root = true + +[*.{fs,fsx,fsi}] +trim_trailing_whitespace = true +fsharp_multiline_block_brackets_on_same_column = true +fsharp_multiline_lambda_closing_newline = true +fsharp_record_multiline_formatter = number_of_items +fsharp_align_function_signature_to_indentation = true +fsharp_keep_max_number_of_blank_lines = 1 +fsharp_multiline_bracket_style = aligned +fsharp_newline_before_multiline_computation_expression = false +indent_size = 2 + +# Visual Studio Solution Files +[*.sln] +indent_style = tab + +# XML project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,sfproj}] +indent_size = 2 + +# Markdown Files +[*.{md,mdx}] +trim_trailing_whitespace = false + +# Bash Files +[*.{sh}] +end_of_line = lf + +# Batch Files +[*.{cmd,bat}] +end_of_line = crlf + +# Powershell Files +[*.{ps1, psm1}] +end_of_line = crlf + +# Paket files +[paket.*] +trim_trailing_whitespace = true +indent_size = 2 + +[*.paket.references] +trim_trailing_whitespace = true +indent_size = 2 + +# YAML Files +[*.{yml,yaml}] +indent_size = 2 +indent_style = space \ No newline at end of file diff --git a/.fantomasignore b/.fantomasignore new file mode 100644 index 0000000..b9a47f0 --- /dev/null +++ b/.fantomasignore @@ -0,0 +1 @@ +AssemblyInfo.fs \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a60c557 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build master + +on: + pull_request: + types: [ opened, synchronize, reopened ] + paths-ignore: + - ".github" + - ".vscode" + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Setup necessary dotnet SDKs + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + dotnet-version: 8.x + + - name: Build via Bash + if: runner.os != 'Windows' + run: | + chmod +x ./build.sh + ./build.sh + env: + CI: true + - name: Build via Windows + if: runner.os == 'Windows' + run: ./build.cmd + env: + CI: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1701c5d..bf895bc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ *.userosscache *.sln.docstates +*.vscode + # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/.paket/paket.bootstrapper.exe b/.paket/paket.bootstrapper.exe deleted file mode 100644 index bc32ded..0000000 Binary files a/.paket/paket.bootstrapper.exe and /dev/null differ diff --git a/.paket/paket.targets b/.paket/paket.targets deleted file mode 100644 index 4ace721..0000000 --- a/.paket/paket.targets +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - true - $(MSBuildThisFileDirectory) - $(MSBuildThisFileDirectory)..\ - $(PaketRootPath)paket.lock - $(PaketRootPath)paket-files\paket.restore.cached - /Library/Frameworks/Mono.framework/Commands/mono - mono - - - False - - - - - - - - - $(PaketRootPath)paket - $(PaketToolsPath)paket - - - - - - $(PaketRootPath)paket.exe - $(PaketToolsPath)paket.exe - - - - - - <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) - <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) - <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false - - - - - - - - - - - <_PaketCommand>dotnet paket - - - - - - $(PaketToolsPath)paket - $(PaketBootStrapperExeDir)paket - - - paket - - - - - <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" - - - - - - - - - - - - - $(MSBuildProjectFullPath).paket.references - - - - - $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references - - - - - $(MSBuildProjectDirectory)\paket.references - - - - - - - - - - - - RestorePackages; $(BuildDependsOn); - - - - - - - $(PaketCommand) restore --references-file "$(PaketReferences)" - true - - - - $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) - $([System.IO.File]::ReadAllText('$(PaketLockFilePath)')) - true - false - true - - - - - \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..16b1f53 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +@1eyewonder \ No newline at end of file diff --git a/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj b/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj deleted file mode 100644 index 1f704af..0000000 --- a/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - Exe - net6.0 - enable - enable - default - false - - - - - - - - diff --git a/Fs.Units.CSharp.Tests.Benchmark/paket.references b/Fs.Units.CSharp.Tests.Benchmark/paket.references deleted file mode 100644 index 68eb79b..0000000 --- a/Fs.Units.CSharp.Tests.Benchmark/paket.references +++ /dev/null @@ -1 +0,0 @@ -BenchmarkDotNet \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/DataTransferRate.cs b/Fs.Units.CSharp/Compound/DataTransferRate.cs deleted file mode 100644 index 7a16252..0000000 --- a/Fs.Units.CSharp/Compound/DataTransferRate.cs +++ /dev/null @@ -1,210 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.DataTransferRate; - -public static class BaudExtensions -{ - public static double BaudToBitsPerSecond(this double x) => Baud.toBitsPerSecond(x); - public static double BaudToKilobitsPerSecond(this double x) => Baud.toKilobitsPerSecond(x); - public static double BaudToMegabitsPerSecond(this double x) => Baud.toMegabitsPerSecond(x); - public static double BaudToGigabitsPerSecond(this double x) => Baud.toGigabitsPerSecond(x); - public static double BaudToTerabitsPerSecond(this double x) => Baud.toTerabitsPerSecond(x); - public static double BaudToPetabitsPerSecond(this double x) => Baud.toPetabitsPerSecond(x); - public static double BaudToBytesPerSecond(this double x) => Baud.toBytesPerSecond(x); - public static double BaudToKilobytesPerSecond(this double x) => Baud.toKilobytesPerSecond(x); - public static double BaudToMegabytesPerSecond(this double x) => Baud.toMegabytesPerSecond(x); - public static double BaudToGigabytesPerSecond(this double x) => Baud.toGigabytesPerSecond(x); - public static double BaudToTerabytesPerSecond(this double x) => Baud.toTerabytesPerSecond(x); - public static double BaudToPetabytesPerSecond(this double x) => Baud.toPetabytesPerSecond(x); -} - -public static class BitPerSecondExtensions -{ - public static double BitPerSecondToBauds(this double x) => BitPerSecond.toBauds(x); - public static double BitPerSecondToKilobitsPerSecond(this double x) => BitPerSecond.toKilobitsPerSecond(x); - public static double BitPerSecondToMegabitsPerSecond(this double x) => BitPerSecond.toMegabitsPerSecond(x); - public static double BitPerSecondToGigabitsPerSecond(this double x) => BitPerSecond.toGigabitsPerSecond(x); - public static double BitPerSecondToTerabitsPerSecond(this double x) => BitPerSecond.toTerabitsPerSecond(x); - public static double BitPerSecondToPetabitsPerSecond(this double x) => BitPerSecond.toPetabitsPerSecond(x); - public static double BitPerSecondToBytesPerSecond(this double x) => BitPerSecond.toBytesPerSecond(x); - public static double BitPerSecondToKilobytesPerSecond(this double x) => BitPerSecond.toKilobytesPerSecond(x); - public static double BitPerSecondToMegabytesPerSecond(this double x) => BitPerSecond.toMegabytesPerSecond(x); - public static double BitPerSecondToGigabytesPerSecond(this double x) => BitPerSecond.toGigabytesPerSecond(x); - public static double BitPerSecondToTerabytesPerSecond(this double x) => BitPerSecond.toTerabytesPerSecond(x); - public static double BitPerSecondToPetabytesPerSecond(this double x) => BitPerSecond.toPetabytesPerSecond(x); -} - -public static class KilobitPerSecondExtensions -{ - public static double KilobitPerSecondToBauds(this double x) => KilobitPerSecond.toBauds(x); - public static double KilobitPerSecondToBitsPerSecond(this double x) => KilobitPerSecond.toBitsPerSecond(x); - public static double KilobitPerSecondToMegabitsPerSecond(this double x) => KilobitPerSecond.toMegabitsPerSecond(x); - public static double KilobitPerSecondToGigabitsPerSecond(this double x) => KilobitPerSecond.toGigabitsPerSecond(x); - public static double KilobitPerSecondToTerabitsPerSecond(this double x) => KilobitPerSecond.toTerabitsPerSecond(x); - public static double KilobitPerSecondToPetabitsPerSecond(this double x) => KilobitPerSecond.toPetabitsPerSecond(x); - public static double KilobitPerSecondToBytesPerSecond(this double x) => KilobitPerSecond.toBytesPerSecond(x); - public static double KilobitPerSecondToKilobytesPerSecond(this double x) => KilobitPerSecond.toKilobytesPerSecond(x); - public static double KilobitPerSecondToMegabytesPerSecond(this double x) => KilobitPerSecond.toMegabytesPerSecond(x); - public static double KilobitPerSecondToGigabytesPerSecond(this double x) => KilobitPerSecond.toGigabytesPerSecond(x); - public static double KilobitPerSecondToTerabytesPerSecond(this double x) => KilobitPerSecond.toTerabytesPerSecond(x); - public static double KilobitPerSecondToPetabytesPerSecond(this double x) => KilobitPerSecond.toPetabytesPerSecond(x); -} - -public static class MegabitPerSecondExtensions -{ - public static double MegabitPerSecondToBauds(this double x) => MegabitPerSecond.toBauds(x); - public static double MegabitPerSecondToBitsPerSecond(this double x) => MegabitPerSecond.toBitsPerSecond(x); - public static double MegabitPerSecondToKilobitsPerSecond(this double x) => MegabitPerSecond.toKilobitsPerSecond(x); - public static double MegabitPerSecondToGigabitsPerSecond(this double x) => MegabitPerSecond.toGigabitsPerSecond(x); - public static double MegabitPerSecondToTerabitsPerSecond(this double x) => MegabitPerSecond.toTerabitsPerSecond(x); - public static double MegabitPerSecondToPetabitsPerSecond(this double x) => MegabitPerSecond.toPetabitsPerSecond(x); - public static double MegabitPerSecondToBytesPerSecond(this double x) => MegabitPerSecond.toBytesPerSecond(x); - public static double MegabitPerSecondToKilobytesPerSecond(this double x) => MegabitPerSecond.toKilobytesPerSecond(x); - public static double MegabitPerSecondToMegabytesPerSecond(this double x) => MegabitPerSecond.toMegabytesPerSecond(x); - public static double MegabitPerSecondToGigabytesPerSecond(this double x) => MegabitPerSecond.toGigabytesPerSecond(x); - public static double MegabitPerSecondToTerabytesPerSecond(this double x) => MegabitPerSecond.toTerabytesPerSecond(x); - public static double MegabitPerSecondToPetabytesPerSecond(this double x) => MegabitPerSecond.toPetabytesPerSecond(x); -} - -public static class GigabitPerSecondExtensions -{ - public static double GigabitPerSecondToBauds(this double x) => GigabitPerSecond.toBauds(x); - public static double GigabitPerSecondToBitsPerSecond(this double x) => GigabitPerSecond.toBitsPerSecond(x); - public static double GigabitPerSecondToKilobitsPerSecond(this double x) => GigabitPerSecond.toKilobitsPerSecond(x); - public static double GigabitPerSecondToMegabitsPerSecond(this double x) => GigabitPerSecond.toMegabitsPerSecond(x); - public static double GigabitPerSecondToTerabitsPerSecond(this double x) => GigabitPerSecond.toTerabitsPerSecond(x); - public static double GigabitPerSecondToPetabitsPerSecond(this double x) => GigabitPerSecond.toPetabitsPerSecond(x); - public static double GigabitPerSecondToBytesPerSecond(this double x) => GigabitPerSecond.toBytesPerSecond(x); - public static double GigabitPerSecondToKilobytesPerSecond(this double x) => GigabitPerSecond.toKilobytesPerSecond(x); - public static double GigabitPerSecondToMegabytesPerSecond(this double x) => GigabitPerSecond.toMegabytesPerSecond(x); - public static double GigabitPerSecondToGigabytesPerSecond(this double x) => GigabitPerSecond.toGigabytesPerSecond(x); - public static double GigabitPerSecondToTerabytesPerSecond(this double x) => GigabitPerSecond.toTerabytesPerSecond(x); - public static double GigabitPerSecondToPetabytesPerSecond(this double x) => GigabitPerSecond.toPetabytesPerSecond(x); -} - -public static class TerabitPerSecondExtensions -{ - public static double TerabitPerSecondToBauds(this double x) => TerabitPerSecond.toBauds(x); - public static double TerabitPerSecondToBitsPerSecond(this double x) => TerabitPerSecond.toBitsPerSecond(x); - public static double TerabitPerSecondToKilobitsPerSecond(this double x) => TerabitPerSecond.toKilobitsPerSecond(x); - public static double TerabitPerSecondToMegabitsPerSecond(this double x) => TerabitPerSecond.toMegabitsPerSecond(x); - public static double TerabitPerSecondToGigabitsPerSecond(this double x) => TerabitPerSecond.toGigabitsPerSecond(x); - public static double TerabitPerSecondToPetabitsPerSecond(this double x) => TerabitPerSecond.toPetabitsPerSecond(x); - public static double TerabitPerSecondToBytesPerSecond(this double x) => TerabitPerSecond.toBytesPerSecond(x); - public static double TerabitPerSecondToKilobytesPerSecond(this double x) => TerabitPerSecond.toKilobytesPerSecond(x); - public static double TerabitPerSecondToMegabytesPerSecond(this double x) => TerabitPerSecond.toMegabytesPerSecond(x); - public static double TerabitPerSecondToGigabytesPerSecond(this double x) => TerabitPerSecond.toGigabytesPerSecond(x); - public static double TerabitPerSecondToTerabytesPerSecond(this double x) => TerabitPerSecond.toTerabytesPerSecond(x); - public static double TerabitPerSecondToPetabytesPerSecond(this double x) => TerabitPerSecond.toPetabytesPerSecond(x); -} - -public static class PetabitPerSecondExtensions -{ - public static double PetabitPerSecondToBauds(this double x) => PetabitPerSecond.toBauds(x); - public static double PetabitPerSecondToBitsPerSecond(this double x) => PetabitPerSecond.toBitsPerSecond(x); - public static double PetabitPerSecondToKilobitsPerSecond(this double x) => PetabitPerSecond.toKilobitsPerSecond(x); - public static double PetabitPerSecondToMegabitsPerSecond(this double x) => PetabitPerSecond.toMegabitsPerSecond(x); - public static double PetabitPerSecondToGigabitsPerSecond(this double x) => PetabitPerSecond.toGigabitsPerSecond(x); - public static double PetabitPerSecondToTerabitsPerSecond(this double x) => PetabitPerSecond.toTerabitsPerSecond(x); - public static double PetabitPerSecondToBytesPerSecond(this double x) => PetabitPerSecond.toBytesPerSecond(x); - public static double PetabitPerSecondToKilobytesPerSecond(this double x) => PetabitPerSecond.toKilobytesPerSecond(x); - public static double PetabitPerSecondToMegabytesPerSecond(this double x) => PetabitPerSecond.toMegabytesPerSecond(x); - public static double PetabitPerSecondToGigabytesPerSecond(this double x) => PetabitPerSecond.toGigabytesPerSecond(x); - public static double PetabitPerSecondToTerabytesPerSecond(this double x) => PetabitPerSecond.toTerabytesPerSecond(x); - public static double PetabitPerSecondToPetabytesPerSecond(this double x) => PetabitPerSecond.toPetabytesPerSecond(x); -} - -public static class BytePerSecondExtensions -{ - public static double BytePerSecondToBauds(this double x) => BytePerSecond.toBauds(x); - public static double BytePerSecondToBitsPerSecond(this double x) => BytePerSecond.toBitsPerSecond(x); - public static double BytePerSecondToKilobitsPerSecond(this double x) => BytePerSecond.toKilobitsPerSecond(x); - public static double BytePerSecondToMegabitsPerSecond(this double x) => BytePerSecond.toMegabitsPerSecond(x); - public static double BytePerSecondToGigabitsPerSecond(this double x) => BytePerSecond.toGigabitsPerSecond(x); - public static double BytePerSecondToTerabitsPerSecond(this double x) => BytePerSecond.toTerabitsPerSecond(x); - public static double BytePerSecondToPetabitsPerSecond(this double x) => BytePerSecond.toPetabitsPerSecond(x); - public static double BytePerSecondToKilobytesPerSecond(this double x) => BytePerSecond.toKilobytesPerSecond(x); - public static double BytePerSecondToMegabytesPerSecond(this double x) => BytePerSecond.toMegabytesPerSecond(x); - public static double BytePerSecondToGigabytesPerSecond(this double x) => BytePerSecond.toGigabytesPerSecond(x); - public static double BytePerSecondToTerabytesPerSecond(this double x) => BytePerSecond.toTerabytesPerSecond(x); - public static double BytePerSecondToPetabytesPerSecond(this double x) => BytePerSecond.toPetabytesPerSecond(x); -} - -public static class KilobytePerSecondExtensions -{ - public static double KilobytePerSecondToBauds(this double x) => KilobytePerSecond.toBauds(x); - public static double KilobytePerSecondToBitsPerSecond(this double x) => KilobytePerSecond.toBitsPerSecond(x); - public static double KilobytePerSecondToKilobitsPerSecond(this double x) => KilobytePerSecond.toKilobitsPerSecond(x); - public static double KilobytePerSecondToMegabitsPerSecond(this double x) => KilobytePerSecond.toMegabitsPerSecond(x); - public static double KilobytePerSecondToGigabitsPerSecond(this double x) => KilobytePerSecond.toGigabitsPerSecond(x); - public static double KilobytePerSecondToTerabitsPerSecond(this double x) => KilobytePerSecond.toTerabitsPerSecond(x); - public static double KilobytePerSecondToPetabitsPerSecond(this double x) => KilobytePerSecond.toPetabitsPerSecond(x); - public static double KilobytePerSecondToBytesPerSecond(this double x) => KilobytePerSecond.toBytesPerSecond(x); - public static double KilobytePerSecondToMegabytesPerSecond(this double x) => KilobytePerSecond.toMegabytesPerSecond(x); - public static double KilobytePerSecondToGigabytesPerSecond(this double x) => KilobytePerSecond.toGigabytesPerSecond(x); - public static double KilobytePerSecondToTerabytesPerSecond(this double x) => KilobytePerSecond.toTerabytesPerSecond(x); - public static double KilobytePerSecondToPetabytesPerSecond(this double x) => KilobytePerSecond.toPetabytesPerSecond(x); -} - -public static class MegabytePerSecondExtensions -{ - public static double MegabytePerSecondToBauds(this double x) => MegabytePerSecond.toBauds(x); - public static double MegabytePerSecondToBitsPerSecond(this double x) => MegabytePerSecond.toBitsPerSecond(x); - public static double MegabytePerSecondToKilobitsPerSecond(this double x) => MegabytePerSecond.toKilobitsPerSecond(x); - public static double MegabytePerSecondToMegabitsPerSecond(this double x) => MegabytePerSecond.toMegabitsPerSecond(x); - public static double MegabytePerSecondToGigabitsPerSecond(this double x) => MegabytePerSecond.toGigabitsPerSecond(x); - public static double MegabytePerSecondToTerabitsPerSecond(this double x) => MegabytePerSecond.toTerabitsPerSecond(x); - public static double MegabytePerSecondToPetabitsPerSecond(this double x) => MegabytePerSecond.toPetabitsPerSecond(x); - public static double MegabytePerSecondToBytesPerSecond(this double x) => MegabytePerSecond.toBytesPerSecond(x); - public static double MegabytePerSecondToKilobytesPerSecond(this double x) => MegabytePerSecond.toKilobytesPerSecond(x); - public static double MegabytePerSecondToGigabytesPerSecond(this double x) => MegabytePerSecond.toGigabytesPerSecond(x); - public static double MegabytePerSecondToTerabytesPerSecond(this double x) => MegabytePerSecond.toTerabytesPerSecond(x); - public static double MegabytePerSecondToPetabytesPerSecond(this double x) => MegabytePerSecond.toPetabytesPerSecond(x); -} - -public static class GigabytePerSecondExtensions -{ - public static double GigabytePerSecondToBauds(this double x) => GigabytePerSecond.toBauds(x); - public static double GigabytePerSecondToBitsPerSecond(this double x) => GigabytePerSecond.toBitsPerSecond(x); - public static double GigabytePerSecondToKilobitsPerSecond(this double x) => GigabytePerSecond.toKilobitsPerSecond(x); - public static double GigabytePerSecondToMegabitsPerSecond(this double x) => GigabytePerSecond.toMegabitsPerSecond(x); - public static double GigabytePerSecondToGigabitsPerSecond(this double x) => GigabytePerSecond.toGigabitsPerSecond(x); - public static double GigabytePerSecondToTerabitsPerSecond(this double x) => GigabytePerSecond.toTerabitsPerSecond(x); - public static double GigabytePerSecondToPetabitsPerSecond(this double x) => GigabytePerSecond.toPetabitsPerSecond(x); - public static double GigabytePerSecondToBytesPerSecond(this double x) => GigabytePerSecond.toBytesPerSecond(x); - public static double GigabytePerSecondToKilobytesPerSecond(this double x) => GigabytePerSecond.toKilobytesPerSecond(x); - public static double GigabytePerSecondToMegabytesPerSecond(this double x) => GigabytePerSecond.toMegabytesPerSecond(x); - public static double GigabytePerSecondToTerabytesPerSecond(this double x) => GigabytePerSecond.toTerabytesPerSecond(x); - public static double GigabytePerSecondToPetabytesPerSecond(this double x) => GigabytePerSecond.toPetabytesPerSecond(x); -} - -public static class TerabytePerSecondExtensions -{ - public static double TerabytePerSecondToBauds(this double x) => TerabytePerSecond.toBauds(x); - public static double TerabytePerSecondToBitsPerSecond(this double x) => TerabytePerSecond.toBitsPerSecond(x); - public static double TerabytePerSecondToKilobitsPerSecond(this double x) => TerabytePerSecond.toKilobitsPerSecond(x); - public static double TerabytePerSecondToMegabitsPerSecond(this double x) => TerabytePerSecond.toMegabitsPerSecond(x); - public static double TerabytePerSecondToGigabitsPerSecond(this double x) => TerabytePerSecond.toGigabitsPerSecond(x); - public static double TerabytePerSecondToTerabitsPerSecond(this double x) => TerabytePerSecond.toTerabitsPerSecond(x); - public static double TerabytePerSecondToPetabitsPerSecond(this double x) => TerabytePerSecond.toPetabitsPerSecond(x); - public static double TerabytePerSecondToBytesPerSecond(this double x) => TerabytePerSecond.toBytesPerSecond(x); - public static double TerabytePerSecondToKilobytesPerSecond(this double x) => TerabytePerSecond.toKilobytesPerSecond(x); - public static double TerabytePerSecondToMegabytesPerSecond(this double x) => TerabytePerSecond.toMegabytesPerSecond(x); - public static double TerabytePerSecondToGigabytesPerSecond(this double x) => TerabytePerSecond.toGigabytesPerSecond(x); - public static double TerabytePerSecondToPetabytesPerSecond(this double x) => TerabytePerSecond.toPetabytesPerSecond(x); -} - -public static class PetabytePerSecondExtensions -{ - public static double PetabytePerSecondToBauds(this double x) => PetabytePerSecond.toBauds(x); - public static double PetabytePerSecondToBitsPerSecond(this double x) => PetabytePerSecond.toBitsPerSecond(x); - public static double PetabytePerSecondToKilobitsPerSecond(this double x) => PetabytePerSecond.toKilobitsPerSecond(x); - public static double PetabytePerSecondToMegabitsPerSecond(this double x) => PetabytePerSecond.toMegabitsPerSecond(x); - public static double PetabytePerSecondToGigabitsPerSecond(this double x) => PetabytePerSecond.toGigabitsPerSecond(x); - public static double PetabytePerSecondToTerabitsPerSecond(this double x) => PetabytePerSecond.toTerabitsPerSecond(x); - public static double PetabytePerSecondToPetabitsPerSecond(this double x) => PetabytePerSecond.toPetabitsPerSecond(x); - public static double PetabytePerSecondToBytesPerSecond(this double x) => PetabytePerSecond.toBytesPerSecond(x); - public static double PetabytePerSecondToKilobytesPerSecond(this double x) => PetabytePerSecond.toKilobytesPerSecond(x); - public static double PetabytePerSecondToMegabytesPerSecond(this double x) => PetabytePerSecond.toMegabytesPerSecond(x); - public static double PetabytePerSecondToGigabytesPerSecond(this double x) => PetabytePerSecond.toGigabytesPerSecond(x); - public static double PetabytePerSecondToTerabytesPerSecond(this double x) => PetabytePerSecond.toTerabytesPerSecond(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/ElectromotiveForce.cs b/Fs.Units.CSharp/Compound/ElectromotiveForce.cs deleted file mode 100644 index 91a53c7..0000000 --- a/Fs.Units.CSharp/Compound/ElectromotiveForce.cs +++ /dev/null @@ -1,42 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.ElectromotiveForce; - -public static class MicrovoltExtensions -{ - public static double MicrovoltToMillivolts(this double x) => Microvolt.toMillivolts(x); - public static double MicrovoltToVolts(this double x) => Microvolt.toVolts(x); - public static double MicrovoltToKilovolts(this double x) => Microvolt.toKilovolts(x); - public static double MicrovoltToMegavolts(this double x) => Microvolt.toMegavolts(x); -} - -public static class MillivoltExtensions -{ - public static double MillivoltToMicrovolts(this double x) => Millivolt.toMicrovolts(x); - public static double MillivoltToVolts(this double x) => Millivolt.toVolts(x); - public static double MillivoltToKilovolts(this double x) => Millivolt.toKilovolts(x); - public static double MillivoltToMegavolts(this double x) => Millivolt.toMegavolts(x); -} - -public static class VoltExtensions -{ - public static double VoltToMicrovolts(this double x) => Volt.toMicrovolts(x); - public static double VoltToMillivolts(this double x) => Volt.toMillivolts(x); - public static double VoltToKilovolts(this double x) => Volt.toKilovolts(x); - public static double VoltToMegavolts(this double x) => Volt.toMegavolts(x); -} - -public static class KilovoltExtensions -{ - public static double KilovoltToMicrovolts(this double x) => Kilovolt.toMicrovolts(x); - public static double KilovoltToMillivolts(this double x) => Kilovolt.toMillivolts(x); - public static double KilovoltToVolts(this double x) => Kilovolt.toVolts(x); - public static double KilovoltToMegavolts(this double x) => Kilovolt.toMegavolts(x); -} - -public static class MegavoltExtensions -{ - public static double MegavoltToMicrovolts(this double x) => Megavolt.toMicrovolts(x); - public static double MegavoltToMillivolts(this double x) => Megavolt.toMillivolts(x); - public static double MegavoltToVolts(this double x) => Megavolt.toVolts(x); - public static double MegavoltToKilovolts(this double x) => Megavolt.toKilovolts(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Energy.cs b/Fs.Units.CSharp/Compound/Energy.cs deleted file mode 100644 index 3e00328..0000000 --- a/Fs.Units.CSharp/Compound/Energy.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Energy; - -public static class JouleExtensions -{ - public static double JouleToKilojoules(this double x) => Joule.toKilojoules(x); - public static double JouleToBritishThermalUnits(this double x) => Joule.toBritishThermalUnits(x); - public static double JouleToCalories(this double x) => Joule.toCalories(x); - public static double JouleToQuads(this double x) => Joule.toQuads(x); - public static double JouleToQs(this double x) => Joule.toQs(x); -} - -public static class KilojouleExtensions -{ - public static double KilojouleToJoules(this double x) => Kilojoule.toJoules(x); - public static double KilojouleToBritishThermalUnits(this double x) => Kilojoule.toBritishThermalUnits(x); - public static double KilojouleToCalories(this double x) => Kilojoule.toCalories(x); - public static double KilojouleToQuads(this double x) => Kilojoule.toQuads(x); - public static double KilojouleToQs(this double x) => Kilojoule.toQs(x); -} - -public static class BritishThermalUnitExtensions -{ - public static double BritishThermalUnitToJoules(this double x) => BritishThermalUnit.toJoules(x); - public static double BritishThermalUnitToKilojoules(this double x) => BritishThermalUnit.toKilojoules(x); - public static double BritishThermalUnitToCalories(this double x) => BritishThermalUnit.toCalories(x); - public static double BritishThermalUnitToQuads(this double x) => BritishThermalUnit.toQuads(x); - public static double BritishThermalUnitToQs(this double x) => BritishThermalUnit.toQs(x); -} - -public static class CalorieExtensions -{ - public static double CalorieToJoules(this double x) => Calorie.toJoules(x); - public static double CalorieToKilojoules(this double x) => Calorie.toKilojoules(x); - public static double CalorieToBritishThermalUnits(this double x) => Calorie.toBritishThermalUnits(x); - public static double CalorieToQuads(this double x) => Calorie.toQuads(x); - public static double CalorieToQs(this double x) => Calorie.toQs(x); -} - -public static class QuadExtensions -{ - public static double QuadToJoules(this double x) => Quad.toJoules(x); - public static double QuadToKilojoules(this double x) => Quad.toKilojoules(x); - public static double QuadToBritishThermalUnits(this double x) => Quad.toBritishThermalUnits(x); - public static double QuadToCalories(this double x) => Quad.toCalories(x); - public static double QuadToQs(this double x) => Quad.toQs(x); -} - -public static class QExtensions -{ - public static double QToJoules(this double x) => Q.toJoules(x); - public static double QToKilojoules(this double x) => Q.toKilojoules(x); - public static double QToBritishThermalUnits(this double x) => Q.toBritishThermalUnits(x); - public static double QToCalories(this double x) => Q.toCalories(x); - public static double QToQuads(this double x) => Q.toQuads(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Force.cs b/Fs.Units.CSharp/Compound/Force.cs deleted file mode 100644 index 2f9face..0000000 --- a/Fs.Units.CSharp/Compound/Force.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Force; - -public static class NewtonExtensions -{ - public static double NewtonToPoundForce(this double x) => Newton.toPoundForce(x); - public static double NewtonToDynes(this double x) => Newton.toDynes(x); - public static double NewtonToKips(this double x) => Newton.toKips(x); -} - -public static class PoundForceExtensions -{ - public static double PoundForceToNewtons(this double x) => PoundForce.toNewtons(x); - public static double PoundForceToDynes(this double x) => PoundForce.toDynes(x); - public static double PoundForceToKips(this double x) => PoundForce.toKips(x); -} - -public static class DyneExtensions -{ - public static double DyneToNewtons(this double x) => Dyne.toNewtons(x); - public static double DyneToPoundForce(this double x) => Dyne.toPoundForce(x); - public static double DyneToKips(this double x) => Dyne.toKips(x); -} - -public static class KipExtensions -{ - public static double KipToNewtons(this double x) => Kip.toNewtons(x); - public static double KipToPoundForce(this double x) => Kip.toPoundForce(x); - public static double KipToDynes(this double x) => Kip.toDynes(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Inductance.cs b/Fs.Units.CSharp/Compound/Inductance.cs deleted file mode 100644 index dc3e830..0000000 --- a/Fs.Units.CSharp/Compound/Inductance.cs +++ /dev/null @@ -1,20 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Inductance; - -public static class MicroHenryExtensions -{ - public static double MicroHenryToMilliHenrys(this double x) => MicroHenry.toMilliHenrys(x); - public static double MicroHenryToHenrys(this double x) => MicroHenry.toHenrys(x); -} - -public static class MilliHenryExtensions -{ - public static double MilliHenryToMicroHenrys(this double x) => MilliHenry.toMicroHenrys(x); - public static double MilliHenryToHenrys(this double x) => MilliHenry.toHenrys(x); -} - -public static class HenryExtensions -{ - public static double HenryToMicroHenrys(this double x) => Henry.toMicroHenrys(x); - public static double HenryToMilliHenrys(this double x) => Henry.toMilliHenrys(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Power.cs b/Fs.Units.CSharp/Compound/Power.cs deleted file mode 100644 index 87fc2ac..0000000 --- a/Fs.Units.CSharp/Compound/Power.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Power; - -public static class WattExtensions -{ - public static double WattToKilowatts(this double x) => Watt.toKilowatts(x); - public static double WattToHorsepower(this double x) => Watt.toHorsepower(x); - public static double WattToTonsOfRefrigeration(this double x) => Watt.toTonsOfRefrigeration(x); -} - -public static class KilowattExtensions -{ - public static double KilowattToWatts(this double x) => Kilowatt.toWatts(x); - public static double KilowattToHorsepower(this double x) => Kilowatt.toHorsepower(x); - public static double KilowattToTonsOfRefrigeration(this double x) => Kilowatt.toTonsOfRefrigeration(x); -} - -public static class HorsepowerExtensions -{ - public static double HorsepowerToWatts(this double x) => Horsepower.toWatts(x); - public static double HorsepowerToKilowatts(this double x) => Horsepower.toKilowatts(x); - public static double HorsepowerToTonsOfRefrigeration(this double x) => Horsepower.toTonsOfRefrigeration(x); -} - -public static class TonOfRefrigerationExtensions -{ - public static double TonOfRefrigerationToWatts(this double x) => TonOfRefrigeration.toWatts(x); - public static double TonOfRefrigerationToKilowatts(this double x) => TonOfRefrigeration.toKilowatts(x); - public static double TonOfRefrigerationToHorsepower(this double x) => TonOfRefrigeration.toHorsepower(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Volume.cs b/Fs.Units.CSharp/Compound/Volume.cs deleted file mode 100644 index 9ed383b..0000000 --- a/Fs.Units.CSharp/Compound/Volume.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Volume; - -public static class CubicInchExtensions -{ - public static double CubicInchToCubicFeet(this double x) => CubicInch.toCubicFeet(x); - public static double CubicInchToCubicCentimeters(this double x) => CubicInch.toCubicCentimeters(x); - public static double CubicInchToCubicMeters(this double x) => CubicInch.toCubicMeters(x); -} - -public static class CubicFootExtensions -{ - public static double CubicFootToCubicInches(this double x) => CubicFoot.toCubicInches(x); - public static double CubicFootToCubicCentimeters(this double x) => CubicFoot.toCubicCentimeters(x); - public static double CubicFootToCubicMeters(this double x) => CubicFoot.toCubicMeters(x); -} - -public static class CubicCentimeterExtensions -{ - public static double CubicCentimeterToCubicInches(this double x) => CubicCentimeter.toCubicInches(x); - public static double CubicCentimeterToCubicFeet(this double x) => CubicCentimeter.toCubicFeet(x); - public static double CubicCentimeterToCubicMeters(this double x) => CubicCentimeter.toCubicMeters(x); -} - -public static class CubicMeterExtensions -{ - public static double CubicMeterToCubicInches(this double x) => CubicMeter.toCubicInches(x); - public static double CubicMeterToCubicFeet(this double x) => CubicMeter.toCubicFeet(x); - public static double CubicMeterToCubicCentimeters(this double x) => CubicMeter.toCubicCentimeters(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Fs.Units.CSharp.csproj.DotSettings b/Fs.Units.CSharp/Fs.Units.CSharp.csproj.DotSettings deleted file mode 100644 index 2195515..0000000 --- a/Fs.Units.CSharp/Fs.Units.CSharp.csproj.DotSettings +++ /dev/null @@ -1,3 +0,0 @@ - - True - True \ No newline at end of file diff --git a/Fs.Units.CSharp/GlobalUsings.cs b/Fs.Units.CSharp/GlobalUsings.cs deleted file mode 100644 index 8c1f4c3..0000000 --- a/Fs.Units.CSharp/GlobalUsings.cs +++ /dev/null @@ -1,24 +0,0 @@ -global using Fs.Units.Length; -global using Fs.Units.Time; -global using Fs.Units.Mass; -global using Fs.Units.Temperature; -global using Fs.Units.Angle; -global using Fs.Units.DataStorage; -global using Fs.Units.FuelEconomy; -global using Fs.Units.Frequency; -global using Fs.Units.Illuminance; -global using Fs.Units.Current; -global using Fs.Units.Area; -global using Fs.Units.Volume; -global using Fs.Units.Inertia; -global using Fs.Units.Speed; -global using Fs.Units.Force; -global using Fs.Units.DataTransferRate; -global using Fs.Units.Density; -global using Fs.Units.Pressure; -global using Fs.Units.Power; -global using Fs.Units.Energy; -global using Fs.Units.ElectricCharge; -global using Fs.Units.ElectromotiveForce; -global using Fs.Units.Capacitance; -global using Fs.Units.Inductance; diff --git a/Fs.Units.CSharp/Simple/Angle.cs b/Fs.Units.CSharp/Simple/Angle.cs deleted file mode 100644 index d338a55..0000000 --- a/Fs.Units.CSharp/Simple/Angle.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Angle; - -public static class DegreeExtensions -{ - public static double DegreeToRadians(this double x) => Degree.toRadians(x); - public static double DegreeToGradians(this double x) => Degree.toGradians(x); - public static double DegreeToRevolutions(this double x) => Degree.toRevolutions(x); - public static double DegreeToArcMinutes(this double x) => Degree.toArcMinutes(x); - public static double DegreeToArcSeconds(this double x) => Degree.toArcSeconds(x); -} - -public static class RadianExtensions -{ - public static double RadianToDegrees(this double x) => Radian.toDegrees(x); - public static double RadianToGradians(this double x) => Radian.toGradians(x); - public static double RadianToRevolutions(this double x) => Radian.toRevolutions(x); - public static double RadianToArcMinutes(this double x) => Radian.toArcMinutes(x); - public static double RadianToArcSeconds(this double x) => Radian.toArcSeconds(x); -} - -public static class GradianExtensions -{ - public static double GradianToDegrees(this double x) => Gradian.toDegrees(x); - public static double GradianToRadians(this double x) => Gradian.toRadians(x); - public static double GradianToRevolutions(this double x) => Gradian.toRevolutions(x); - public static double GradianToArcMinutes(this double x) => Gradian.toArcMinutes(x); - public static double GradianToArcSeconds(this double x) => Gradian.toArcSeconds(x); -} - -public static class RevolutionExtensions -{ - public static double RevolutionToDegrees(this double x) => Revolution.toDegrees(x); - public static double RevolutionToRadians(this double x) => Revolution.toRadians(x); - public static double RevolutionToGradians(this double x) => Revolution.toGradians(x); - public static double RevolutionToArcMinutes(this double x) => Revolution.toArcMinutes(x); - public static double RevolutionToArcSeconds(this double x) => Revolution.toArcSeconds(x); -} - -public static class ArcMinuteExtensions -{ - public static double ArcMinuteToDegrees(this double x) => ArcMinute.toDegrees(x); - public static double ArcMinuteToRadians(this double x) => ArcMinute.toRadians(x); - public static double ArcMinuteToGradians(this double x) => ArcMinute.toGradians(x); - public static double ArcMinuteToRevolutions(this double x) => ArcMinute.toRevolutions(x); - public static double ArcMinuteToArcSeconds(this double x) => ArcMinute.toArcSeconds(x); -} - -public static class ArcSecondExtensions -{ - public static double ArcSecondToDegrees(this double x) => ArcSecond.toDegrees(x); - public static double ArcSecondToRadians(this double x) => ArcSecond.toRadians(x); - public static double ArcSecondToGradians(this double x) => ArcSecond.toGradians(x); - public static double ArcSecondToRevolutions(this double x) => ArcSecond.toRevolutions(x); - public static double ArcSecondToArcMinutes(this double x) => ArcSecond.toArcMinutes(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Current.cs b/Fs.Units.CSharp/Simple/Current.cs deleted file mode 100644 index 02023fe..0000000 --- a/Fs.Units.CSharp/Simple/Current.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Current; - -public static class MicroampereExtensions -{ - public static double MicroampereToAmperes(this double x) => Microampere.toAmperes(x); - public static double MicroampereToMilliamperes(this double x) => Microampere.toMilliamperes(x); - public static double MicroampereToBiots(this double x) => Microampere.toBiots(x); -} - -public static class MilliampereExtensions -{ - public static double MilliampereToAmperes(this double x) => Milliampere.toAmperes(x); - public static double MilliampereToMicroamperes(this double x) => Milliampere.toMicroamperes(x); - public static double MilliampereToBiots(this double x) => Milliampere.toBiots(x); -} - -public static class AmpereExtensions -{ - public static double AmpereToMilliamperes(this double x) => Ampere.toMilliamperes(x); - public static double AmpereToMicroamperes(this double x) => Ampere.toMicroamperes(x); - public static double AmpereToBiots(this double x) => Ampere.toBiots(x); -} - -public static class BiotExtensions -{ - public static double BiotToAmperes(this double x) => Biot.toAmperes(x); - public static double BiotToMilliamperes(this double x) => Biot.toMilliamperes(x); - public static double BiotToMicroamperes(this double x) => Biot.toMicroamperes(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/DataStorage.cs b/Fs.Units.CSharp/Simple/DataStorage.cs deleted file mode 100644 index 144129a..0000000 --- a/Fs.Units.CSharp/Simple/DataStorage.cs +++ /dev/null @@ -1,183 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.DataStorage; - -public static class BitExtensions -{ - public static double BitToKilobits(this double x) => Bit.toKilobits(x); - public static double BitToMegabits(this double x) => Bit.toMegabits(x); - public static double BitToGigabits(this double x) => Bit.toGigabits(x); - public static double BitToTerabits(this double x) => Bit.toTerabits(x); - public static double BitToPetabits(this double x) => Bit.toPetabits(x); - public static double BitToBytes(this double x) => Bit.toBytes(x); - public static double BitToKilobytes(this double x) => Bit.toKilobytes(x); - public static double BitToMegabytes(this double x) => Bit.toMegabytes(x); - public static double BitToGigabytes(this double x) => Bit.toGigabytes(x); - public static double BitToTerabytes(this double x) => Bit.toTerabytes(x); - public static double BitToPetabytes(this double x) => Bit.toPetabytes(x); -} - -public static class KilobitExtensions -{ - public static double KilobitsToBits(this double x) => Kilobit.toBits(x); - public static double KilobitsToMegabits(this double x) => Kilobit.toMegabits(x); - public static double KilobitsToGigabits(this double x) => Kilobit.toGigabits(x); - public static double KilobitsToTerabits(this double x) => Kilobit.toTerabits(x); - public static double KilobitsToPetabits(this double x) => Kilobit.toPetabits(x); - public static double KilobitsToBytes(this double x) => Kilobit.toBytes(x); - public static double KilobitsToKilobytes(this double x) => Kilobit.toKilobytes(x); - public static double KilobitsToMegabytes(this double x) => Kilobit.toMegabytes(x); - public static double KilobitsToGigabytes(this double x) => Kilobit.toGigabytes(x); - public static double KilobitsToTerabytes(this double x) => Kilobit.toTerabytes(x); - public static double KilobitsToPetabytes(this double x) => Kilobit.toPetabytes(x); -} - -public static class MegabitExtensions -{ - public static double MegabitsToBits(this double x) => Megabit.toBits(x); - public static double MegabitsToKilobits(this double x) => Megabit.toKilobits(x); - public static double MegabitsToGigabits(this double x) => Megabit.toGigabits(x); - public static double MegabitsToTerabits(this double x) => Megabit.toTerabits(x); - public static double MegabitsToPetabits(this double x) => Megabit.toPetabits(x); - public static double MegabitsToBytes(this double x) => Megabit.toBytes(x); - public static double MegabitsToKilobytes(this double x) => Megabit.toKilobytes(x); - public static double MegabitsToMegabytes(this double x) => Megabit.toMegabytes(x); - public static double MegabitsToGigabytes(this double x) => Megabit.toGigabytes(x); - public static double MegabitsToTerabytes(this double x) => Megabit.toTerabytes(x); - public static double MegabitsToPetabytes(this double x) => Megabit.toPetabytes(x); -} - -public static class GigabitExtensions -{ - public static double GigabitsToBits(this double x) => Gigabit.toBits(x); - public static double GigabitsToKilobits(this double x) => Gigabit.toKilobits(x); - public static double GigabitsToMegabits(this double x) => Gigabit.toMegabits(x); - public static double GigabitsToTerabits(this double x) => Gigabit.toTerabits(x); - public static double GigabitsToPetabits(this double x) => Gigabit.toPetabits(x); - public static double GigabitsToBytes(this double x) => Gigabit.toBytes(x); - public static double GigabitsToKilobytes(this double x) => Gigabit.toKilobytes(x); - public static double GigabitsToMegabytes(this double x) => Gigabit.toMegabytes(x); - public static double GigabitsToGigabytes(this double x) => Gigabit.toGigabytes(x); - public static double GigabitsToTerabytes(this double x) => Gigabit.toTerabytes(x); - public static double GigabitsToPetabytes(this double x) => Gigabit.toPetabytes(x); -} - -public static class TerabitExtensions -{ - public static double TerabitsToBits(this double x) => Terabit.toBits(x); - public static double TerabitsToKilobits(this double x) => Terabit.toKilobits(x); - public static double TerabitsToMegabits(this double x) => Terabit.toMegabits(x); - public static double TerabitsToGigabits(this double x) => Terabit.toGigabits(x); - public static double TerabitsToPetabits(this double x) => Terabit.toPetabits(x); - public static double TerabitsToBytes(this double x) => Terabit.toBytes(x); - public static double TerabitsToKilobytes(this double x) => Terabit.toKilobytes(x); - public static double TerabitsToMegabytes(this double x) => Terabit.toMegabytes(x); - public static double TerabitsToGigabytes(this double x) => Terabit.toGigabytes(x); - public static double TerabitsToTerabytes(this double x) => Terabit.toTerabytes(x); - public static double TerabitsToPetabytes(this double x) => Terabit.toPetabytes(x); -} - -public static class PetabitExtensions -{ - public static double PetabitsToBits(this double x) => Petabit.toBits(x); - public static double PetabitsToKilobits(this double x) => Petabit.toKilobits(x); - public static double PetabitsToMegabits(this double x) => Petabit.toMegabits(x); - public static double PetabitsToGigabits(this double x) => Petabit.toGigabits(x); - public static double PetabitsToTerabits(this double x) => Petabit.toTerabits(x); - public static double PetabitsToBytes(this double x) => Petabit.toBytes(x); - public static double PetabitsToKilobytes(this double x) => Petabit.toKilobytes(x); - public static double PetabitsToMegabytes(this double x) => Petabit.toMegabytes(x); - public static double PetabitsToGigabytes(this double x) => Petabit.toGigabytes(x); - public static double PetabitsToTerabytes(this double x) => Petabit.toTerabytes(x); - public static double PetabitsToPetabytes(this double x) => Petabit.toPetabytes(x); -} - -public static class ByteExtensions -{ - public static double BytesToBits(this double x) => Units.DataStorage.Byte.toBits(x); - public static double BytesToKilobits(this double x) => Units.DataStorage.Byte.toKilobits(x); - public static double BytesToMegabits(this double x) => Units.DataStorage.Byte.toMegabits(x); - public static double BytesToGigabits(this double x) => Units.DataStorage.Byte.toGigabits(x); - public static double BytesToTerabits(this double x) => Units.DataStorage.Byte.toTerabits(x); - public static double BytesToPetabits(this double x) => Units.DataStorage.Byte.toPetabits(x); - public static double BytesToKilobytes(this double x) => Units.DataStorage.Byte.toKilobytes(x); - public static double BytesToMegabytes(this double x) => Units.DataStorage.Byte.toMegabytes(x); - public static double BytesToGigabytes(this double x) => Units.DataStorage.Byte.toGigabytes(x); - public static double BytesToTerabytes(this double x) => Units.DataStorage.Byte.toTerabytes(x); - public static double BytesToPetabytes(this double x) => Units.DataStorage.Byte.toPetabytes(x); -} - -public static class KilobyteExtensions -{ - public static double KilobytesToBits(this double x) => Kilobyte.toBits(x); - public static double KilobytesToKilobits(this double x) => Kilobyte.toKilobits(x); - public static double KilobytesToMegabits(this double x) => Kilobyte.toMegabits(x); - public static double KilobytesToGigabits(this double x) => Kilobyte.toGigabits(x); - public static double KilobytesToTerabits(this double x) => Kilobyte.toTerabits(x); - public static double KilobytesToPetabits(this double x) => Kilobyte.toPetabits(x); - public static double KilobytesToBytes(this double x) => Kilobyte.toBytes(x); - public static double KilobytesToMegabytes(this double x) => Kilobyte.toMegabytes(x); - public static double KilobytesToGigabytes(this double x) => Kilobyte.toGigabytes(x); - public static double KilobytesToTerabytes(this double x) => Kilobyte.toTerabytes(x); - public static double KilobytesToPetabytes(this double x) => Kilobyte.toPetabytes(x); -} - -public static class MegabyteExtensions -{ - public static double MegabytesToBits(this double x) => Megabyte.toBits(x); - public static double MegabytesToKilobits(this double x) => Megabyte.toKilobits(x); - public static double MegabytesToMegabits(this double x) => Megabyte.toMegabits(x); - public static double MegabytesToGigabits(this double x) => Megabyte.toGigabits(x); - public static double MegabytesToTerabits(this double x) => Megabyte.toTerabits(x); - public static double MegabytesToPetabits(this double x) => Megabyte.toPetabits(x); - public static double MegabytesToBytes(this double x) => Megabyte.toBytes(x); - public static double MegabytesToKilobytes(this double x) => Megabyte.toKilobytes(x); - public static double MegabytesToGigabytes(this double x) => Megabyte.toGigabytes(x); - public static double MegabytesToTerabytes(this double x) => Megabyte.toTerabytes(x); - public static double MegabytesToPetabytes(this double x) => Megabyte.toPetabytes(x); -} - -public static class GigabyteExtensions -{ - public static double GigabytesToBits(this double x) => Gigabyte.toBits(x); - public static double GigabytesToKilobits(this double x) => Gigabyte.toKilobits(x); - public static double GigabytesToMegabits(this double x) => Gigabyte.toMegabits(x); - public static double GigabytesToGigabits(this double x) => Gigabyte.toGigabits(x); - public static double GigabytesToTerabits(this double x) => Gigabyte.toTerabits(x); - public static double GigabytesToPetabits(this double x) => Gigabyte.toPetabits(x); - public static double GigabytesToBytes(this double x) => Gigabyte.toBytes(x); - public static double GigabytesToKilobytes(this double x) => Gigabyte.toKilobytes(x); - public static double GigabytesToMegabytes(this double x) => Gigabyte.toMegabytes(x); - public static double GigabytesToTerabytes(this double x) => Gigabyte.toTerabytes(x); - public static double GigabytesToPetabytes(this double x) => Gigabyte.toPetabytes(x); -} - -public static class TerabyteExtensions -{ - public static double TerabytesToBits(this double x) => Terabyte.toBits(x); - public static double TerabytesToKilobits(this double x) => Terabyte.toKilobits(x); - public static double TerabytesToMegabits(this double x) => Terabyte.toMegabits(x); - public static double TerabytesToGigabits(this double x) => Terabyte.toGigabits(x); - public static double TerabytesToTerabits(this double x) => Terabyte.toTerabits(x); - public static double TerabytesToPetabits(this double x) => Terabyte.toPetabits(x); - public static double TerabytesToBytes(this double x) => Terabyte.toBytes(x); - public static double TerabytesToKilobytes(this double x) => Terabyte.toKilobytes(x); - public static double TerabytesToMegabytes(this double x) => Terabyte.toMegabytes(x); - public static double TerabytesToGigabytes(this double x) => Terabyte.toGigabytes(x); - public static double TerabytesToPetabytes(this double x) => Terabyte.toPetabytes(x); -} - -public static class PetabyteExtensions -{ - public static double PetabytesToBits(this double x) => Petabyte.toBits(x); - public static double PetabytesToKilobits(this double x) => Petabyte.toKilobits(x); - public static double PetabytesToMegabits(this double x) => Petabyte.toMegabits(x); - public static double PetabytesToGigabits(this double x) => Petabyte.toGigabits(x); - public static double PetabytesToTerabits(this double x) => Petabyte.toTerabits(x); - public static double PetabytesToPetabits(this double x) => Petabyte.toPetabits(x); - public static double PetabytesToBytes(this double x) => Petabyte.toBytes(x); - public static double PetabytesToKilobytes(this double x) => Petabyte.toKilobytes(x); - public static double PetabytesToMegabytes(this double x) => Petabyte.toMegabytes(x); - public static double PetabytesToGigabytes(this double x) => Petabyte.toGigabytes(x); - public static double PetabytesToTerabytes(this double x) => Petabyte.toTerabytes(x); -} - diff --git a/Fs.Units.CSharp/Simple/Frequency.cs b/Fs.Units.CSharp/Simple/Frequency.cs deleted file mode 100644 index 91daac2..0000000 --- a/Fs.Units.CSharp/Simple/Frequency.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Frequency; - -public static class HertzExtensions -{ - public static double HertzToKilohertz(this double x) => Hertz.toKilohertz(x); - public static double HertzToMegahertz(this double x) => Hertz.toMegahertz(x); - public static double HertzToGigahertz(this double x) => Hertz.toGigahertz(x); -} - -public static class KilohertzExtensions -{ - public static double KilohertzToHertz(this double x) => Kilohertz.toHertz(x); - public static double KilohertzToMegahertz(this double x) => Kilohertz.toMegahertz(x); - public static double KilohertzToGigahertz(this double x) => Kilohertz.toGigahertz(x); -} - -public static class MegahertzExtensions -{ - public static double MegahertzToHertz(this double x) => Megahertz.toHertz(x); - public static double MegahertzToKilohertz(this double x) => Megahertz.toKilohertz(x); - public static double MegahertzToGigahertz(this double x) => Megahertz.toGigahertz(x); -} - -public static class GigahertzExtensions -{ - public static double GigahertzToHertz(this double x) => Gigahertz.toHertz(x); - public static double GigahertzToKilohertz(this double x) => Gigahertz.toKilohertz(x); - public static double GigahertzToMegahertz(this double x) => Gigahertz.toMegahertz(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Illuminance.cs b/Fs.Units.CSharp/Simple/Illuminance.cs deleted file mode 100644 index 956596c..0000000 --- a/Fs.Units.CSharp/Simple/Illuminance.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Illuminance; - -public static class FootcandleExtensions -{ - public static double FootcandleToLux(this double x) => Footcandle.toLux(x); - public static double FootcandleToPhot(this double x) => Footcandle.toPhot(x); - public static double FootcandleToNox(this double x) => Footcandle.toNox(x); -} - -public static class LuxExtensions -{ - public static double LuxToFootcandle(this double x) => Lux.toFootcandle(x); - public static double LuxToPhot(this double x) => Lux.toPhot(x); - public static double LuxToNox(this double x) => Lux.toNox(x); -} - -public static class PhotExtensions -{ - public static double PhotToFootcandle(this double x) => Phot.toFootcandle(x); - public static double PhotToLux(this double x) => Phot.toLux(x); - public static double PhotToNox(this double x) => Phot.toNox(x); -} - -public static class NoxExtensions -{ - public static double NoxToFootcandle(this double x) => Nox.toFootcandle(x); - public static double NoxToLux(this double x) => Nox.toLux(x); - public static double NoxToPhot(this double x) => Nox.toPhot(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Length.cs b/Fs.Units.CSharp/Simple/Length.cs deleted file mode 100644 index 924581c..0000000 --- a/Fs.Units.CSharp/Simple/Length.cs +++ /dev/null @@ -1,223 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Length; - -public static class InchExtensions -{ - public static double InchToFeet(this double x) => Inch.toFeet(x); - public static double InchToYards(this double x) => Inch.toYards(x); - public static double InchToMiles(this double x) => Inch.toMiles(x); - public static double InchToMillimeters(this double x) => Inch.toMillimeters(x); - public static double InchToCentimeters(this double x) => Inch.toCentimeters(x); - public static double InchToMeters(this double x) => Inch.toMeters(x); - public static double InchToKilometers(this double x) => Inch.toKilometers(x); - public static double InchToNauticalMiles(this double x) => Inch.toNauticalMiles(x); - public static double InchToChains(this double x) => Inch.toChains(x); - public static double InchToFurlongs(this double x) => Inch.toFurlongs(x); - public static double InchToLeagues(this double x) => Inch.toLeagues(x); - public static double InchToHands(this double x) => Inch.toHands(x); - public static double InchToRods(this double x) => Inch.toRods(x); -} - -public static class FootExtensions -{ - public static double FootToInches(this double x) => Foot.toInches(x); - public static double FootToYards(this double x) => Foot.toYards(x); - public static double FootToMiles(this double x) => Foot.toMiles(x); - public static double FootToMillimeters(this double x) => Foot.toMillimeters(x); - public static double FootToCentimeters(this double x) => Foot.toCentimeters(x); - public static double FootToMeters(this double x) => Foot.toMeters(x); - public static double FootToKilometers(this double x) => Foot.toKilometers(x); - public static double FootToNauticalMiles(this double x) => Foot.toNauticalMiles(x); - public static double FootToChains(this double x) => Foot.toChains(x); - public static double FootToFurlongs(this double x) => Foot.toFurlongs(x); - public static double FootToLeagues(this double x) => Foot.toLeagues(x); - public static double FootToHands(this double x) => Foot.toHands(x); - public static double FootToRods(this double x) => Foot.toRods(x); -} - -public static class YardExtensions -{ - public static double YardToInches(this double x) => Yard.toInches(x); - public static double YardToFeet(this double x) => Yard.toFeet(x); - public static double YardToMiles(this double x) => Yard.toMiles(x); - public static double YardToMillimeters(this double x) => Yard.toMillimeters(x); - public static double YardToCentimeters(this double x) => Yard.toCentimeters(x); - public static double YardToMeters(this double x) => Yard.toMeters(x); - public static double YardToKilometers(this double x) => Yard.toKilometers(x); - public static double YardToNauticalMiles(this double x) => Yard.toNauticalMiles(x); - public static double YardToChains(this double x) => Yard.toChains(x); - public static double YardToFurlongs(this double x) => Yard.toFurlongs(x); - public static double YardToLeagues(this double x) => Yard.toLeagues(x); - public static double YardToHands(this double x) => Yard.toHands(x); - public static double YardToRods(this double x) => Yard.toRods(x); -} - -public static class MileExtensions -{ - public static double MileToInches(this double x) => Mile.toInches(x); - public static double MileToFeet(this double x) => Mile.toFeet(x); - public static double MileToYards(this double x) => Mile.toYards(x); - public static double MileToMillimeters(this double x) => Mile.toMillimeters(x); - public static double MileToCentimeters(this double x) => Mile.toCentimeters(x); - public static double MileToMeters(this double x) => Mile.toMeters(x); - public static double MileToKilometers(this double x) => Mile.toKilometers(x); - public static double MileToNauticalMiles(this double x) => Mile.toNauticalMiles(x); - public static double MileToChains(this double x) => Mile.toChains(x); - public static double MileToFurlongs(this double x) => Mile.toFurlongs(x); - public static double MileToLeagues(this double x) => Mile.toLeagues(x); - public static double MileToHands(this double x) => Mile.toHands(x); - public static double MileToRods(this double x) => Mile.toRods(x); -} - -public static class MillimeterExtensions -{ - public static double MillimeterToInches(this double x) => Millimeter.toInches(x); - public static double MillimeterToFeet(this double x) => Millimeter.toFeet(x); - public static double MillimeterToYards(this double x) => Millimeter.toYards(x); - public static double MillimeterToMiles(this double x) => Millimeter.toMiles(x); - public static double MillimeterToCentimeters(this double x) => Millimeter.toCentimeters(x); - public static double MillimeterToMeters(this double x) => Millimeter.toMeters(x); - public static double MillimeterToKilometers(this double x) => Millimeter.toKilometers(x); - public static double MillimeterToNauticalMiles(this double x) => Millimeter.toNauticalMiles(x); - public static double MillimeterToChains(this double x) => Millimeter.toChains(x); - public static double MillimeterToFurlongs(this double x) => Millimeter.toFurlongs(x); - public static double MillimeterToLeagues(this double x) => Millimeter.toLeagues(x); - public static double MillimeterToHands(this double x) => Millimeter.toHands(x); - public static double MillimeterToRods(this double x) => Millimeter.toRods(x); -} - -public static class CentimeterExtensions -{ - public static double CentimeterToInches(this double x) => Centimeter.toInches(x); - public static double CentimeterToFeet(this double x) => Centimeter.toFeet(x); - public static double CentimeterToYards(this double x) => Centimeter.toYards(x); - public static double CentimeterToMiles(this double x) => Centimeter.toMiles(x); - public static double CentimeterToMillimeters(this double x) => Centimeter.toMillimeters(x); - public static double CentimeterToMeters(this double x) => Centimeter.toMeters(x); - public static double CentimeterToKilometers(this double x) => Centimeter.toKilometers(x); - public static double CentimeterToNauticalMiles(this double x) => Centimeter.toNauticalMiles(x); - public static double CentimeterToChains(this double x) => Centimeter.toChains(x); - public static double CentimeterToFurlongs(this double x) => Centimeter.toFurlongs(x); - public static double CentimeterToLeagues(this double x) => Centimeter.toLeagues(x); - public static double CentimeterToHands(this double x) => Centimeter.toHands(x); - public static double CentimeterToRods(this double x) => Centimeter.toRods(x); -} - -public static class MeterExtensions -{ - public static double MeterToInches(this double x) => Meter.toInches(x); - public static double MeterToFeet(this double x) => Meter.toFeet(x); - public static double MeterToYards(this double x) => Meter.toYards(x); - public static double MeterToMiles(this double x) => Meter.toMiles(x); - public static double MeterToMillimeters(this double x) => Meter.toMillimeters(x); - public static double MeterToCentimeters(this double x) => Meter.toCentimeters(x); - public static double MeterToKilometers(this double x) => Meter.toKilometers(x); - public static double MeterToNauticalMiles(this double x) => Meter.toNauticalMiles(x); - public static double MeterToChains(this double x) => Meter.toChains(x); - public static double MeterToFurlongs(this double x) => Meter.toFurlongs(x); - public static double MeterToLeagues(this double x) => Meter.toLeagues(x); - public static double MeterToHands(this double x) => Meter.toHands(x); - public static double MeterToRods(this double x) => Meter.toRods(x); -} - -public static class KilometerExtensions -{ - public static double KilometerToInches(this double x) => Kilometer.toInches(x); - public static double KilometerToFeet(this double x) => Kilometer.toFeet(x); - public static double KilometerToYards(this double x) => Kilometer.toYards(x); - public static double KilometerToMiles(this double x) => Kilometer.toMiles(x); - public static double KilometerToMillimeters(this double x) => Kilometer.toMillimeters(x); - public static double KilometerToCentimeters(this double x) => Kilometer.toCentimeters(x); - public static double KilometerToMeters(this double x) => Kilometer.toMeters(x); - public static double KilometerToNauticalMiles(this double x) => Kilometer.toNauticalMiles(x); - public static double KilometerToChains(this double x) => Kilometer.toChains(x); - public static double KilometerToFurlongs(this double x) => Kilometer.toFurlongs(x); - public static double KilometerToLeagues(this double x) => Kilometer.toLeagues(x); - public static double KilometerToHands(this double x) => Kilometer.toHands(x); - public static double KilometerToRods(this double x) => Kilometer.toRods(x); -} - -public static class NauticalMileExtensions -{ - public static double NauticalMileToInches(this double x) => NauticalMile.toInches(x); - public static double NauticalMileToFeet(this double x) => NauticalMile.toFeet(x); - public static double NauticalMileToYards(this double x) => NauticalMile.toYards(x); - public static double NauticalMileToMiles(this double x) => NauticalMile.toMiles(x); - public static double NauticalMileToMillimeters(this double x) => NauticalMile.toMillimeters(x); - public static double NauticalMileToCentimeters(this double x) => NauticalMile.toCentimeters(x); - public static double NauticalMileToMeters(this double x) => NauticalMile.toMeters(x); - public static double NauticalMileToKilometers(this double x) => NauticalMile.toKilometers(x); - public static double NauticalMileToChains(this double x) => NauticalMile.toChains(x); - public static double NauticalMileToFurlongs(this double x) => NauticalMile.toFurlongs(x); - public static double NauticalMileToLeagues(this double x) => NauticalMile.toLeagues(x); - public static double NauticalMileToHands(this double x) => NauticalMile.toHands(x); - public static double NauticalMileToRods(this double x) => NauticalMile.toRods(x); -} - -public static class ChainExtensions -{ - public static double ChainToInches(this double x) => Chain.toInches(x); - public static double ChainToFeet(this double x) => Chain.toFeet(x); - public static double ChainToYards(this double x) => Chain.toYards(x); - public static double ChainToMiles(this double x) => Chain.toMiles(x); - public static double ChainToMillimeters(this double x) => Chain.toMillimeters(x); - public static double ChainToCentimeters(this double x) => Chain.toCentimeters(x); - public static double ChainToMeters(this double x) => Chain.toMeters(x); - public static double ChainToKilometers(this double x) => Chain.toKilometers(x); - public static double ChainToNauticalMiles(this double x) => Chain.toNauticalMiles(x); - public static double ChainToFurlongs(this double x) => Chain.toFurlongs(x); - public static double ChainToLeagues(this double x) => Chain.toLeagues(x); - public static double ChainToHands(this double x) => Chain.toHands(x); - public static double ChainToRods(this double x) => Chain.toRods(x); -} - -public static class FurlongExtensions -{ - public static double FurlongToInches(this double x) => Furlong.toInches(x); - public static double FurlongToFeet(this double x) => Furlong.toFeet(x); - public static double FurlongToYards(this double x) => Furlong.toYards(x); - public static double FurlongToMiles(this double x) => Furlong.toMiles(x); - public static double FurlongToMillimeters(this double x) => Furlong.toMillimeters(x); - public static double FurlongToCentimeters(this double x) => Furlong.toCentimeters(x); - public static double FurlongToMeters(this double x) => Furlong.toMeters(x); - public static double FurlongToKilometers(this double x) => Furlong.toKilometers(x); - public static double FurlongToNauticalMiles(this double x) => Furlong.toNauticalMiles(x); - public static double FurlongToChains(this double x) => Furlong.toChains(x); - public static double FurlongToLeagues(this double x) => Furlong.toLeagues(x); - public static double FurlongToHands(this double x) => Furlong.toHands(x); - public static double FurlongToRods(this double x) => Furlong.toRods(x); -} - -public static class LeagueExtensions -{ - public static double LeagueToInches(this double x) => League.toInches(x); - public static double LeagueToFeet(this double x) => League.toFeet(x); - public static double LeagueToYards(this double x) => League.toYards(x); - public static double LeagueToMiles(this double x) => League.toMiles(x); - public static double LeagueToMillimeters(this double x) => League.toMillimeters(x); - public static double LeagueToCentimeters(this double x) => League.toCentimeters(x); - public static double LeagueToMeters(this double x) => League.toMeters(x); - public static double LeagueToKilometers(this double x) => League.toKilometers(x); - public static double LeagueToNauticalMiles(this double x) => League.toNauticalMiles(x); - public static double LeagueToChains(this double x) => League.toChains(x); - public static double LeagueToFurlongs(this double x) => League.toFurlongs(x); - public static double LeagueToHands(this double x) => League.toHands(x); - public static double LeagueToRods(this double x) => League.toRods(x); -} - -public static class HandExtensions -{ - public static double HandToInches(this double x) => Hand.toInches(x); - public static double HandToFeet(this double x) => Hand.toFeet(x); - public static double HandToYards(this double x) => Hand.toYards(x); - public static double HandToMiles(this double x) => Hand.toMiles(x); - public static double HandToMillimeters(this double x) => Hand.toMillimeters(x); - public static double HandToCentimeters(this double x) => Hand.toCentimeters(x); - public static double HandToMeters(this double x) => Hand.toMeters(x); - public static double HandToKilometers(this double x) => Hand.toKilometers(x); - public static double HandToNauticalMiles(this double x) => Hand.toNauticalMiles(x); - public static double HandToChains(this double x) => Hand.toChains(x); - public static double HandToFurlongs(this double x) => Hand.toFurlongs(x); - public static double HandToLeagues(this double x) => Hand.toLeagues(x); - public static double HandToRods(this double x) => Hand.toRods(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Mass.cs b/Fs.Units.CSharp/Simple/Mass.cs deleted file mode 100644 index 83281fd..0000000 --- a/Fs.Units.CSharp/Simple/Mass.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Mass; - -public static class MilligramExtensions -{ - public static double MilligramToGrams(this double x) => Milligram.toGrams(x); - public static double MilligramToKilograms(this double x) => Milligram.toKilograms(x); - public static double MilligramToPoundMass(this double x) => Milligram.toPoundMass(x); -} - -public static class GramExtensions -{ - public static double GramToMilligrams(this double x) => Gram.toMilligrams(x); - public static double GramToKilograms(this double x) => Gram.toKilograms(x); - public static double GramToPoundMass(this double x) => Gram.toPoundMass(x); -} - -public static class KilogramExtensions -{ - public static double KilogramToMilligrams(this double x) => Kilogram.toMilligrams(x); - public static double KilogramToGrams(this double x) => Kilogram.toGrams(x); - public static double KilogramToPoundMass(this double x) => Kilogram.toPoundMass(x); -} - -public static class PoundMassExtensions -{ - public static double PoundMassToMilligrams(this double x) => PoundMass.toMilligrams(x); - public static double PoundMassToGrams(this double x) => PoundMass.toGrams(x); - public static double PoundMassToKilograms(this double x) => PoundMass.toKilograms(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Temperature.cs b/Fs.Units.CSharp/Simple/Temperature.cs deleted file mode 100644 index ce26ddb..0000000 --- a/Fs.Units.CSharp/Simple/Temperature.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Temperature; - -public static class KelvinExtensions -{ - public static double KelvinToCelsius(this double x) => Kelvin.toCelsius(x); - public static double KelvinToFahrenheit(this double x) => Kelvin.toFahrenheit(x); - public static double KelvinToRankine(this double x) => Kelvin.toRankine(x); -} - -public static class CelsiusExtensions -{ - public static double CelsiusToKelvin(this double x) => Celsius.toKelvin(x); - public static double CelsiusToFahrenheit(this double x) => Celsius.toFahrenheit(x); - public static double CelsiusToRankine(this double x) => Celsius.toRankine(x); -} - -public static class FahrenheitExtensions -{ - public static double FahrenheitToKelvin(this double x) => Fahrenheit.toKelvin(x); - public static double FahrenheitToCelsius(this double x) => Fahrenheit.toCelsius(x); - public static double FahrenheitToRankine(this double x) => Fahrenheit.toRankine(x); -} - -public static class RankineExtensions -{ - public static double RankineToKelvin(this double x) => Rankine.toKelvin(x); - public static double RankineToCelsius(this double x) => Rankine.toCelsius(x); - public static double RankineToFahrenheit(this double x) => Rankine.toFahrenheit(x); -} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/Time.cs b/Fs.Units.CSharp/Simple/Time.cs deleted file mode 100644 index 520f66e..0000000 --- a/Fs.Units.CSharp/Simple/Time.cs +++ /dev/null @@ -1,272 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Time; - -public static class NanosecondExtensions -{ - public static double NanosecondToMicroseconds(this double x) => Nanosecond.toMicroSeconds(x); - public static double NanosecondToMilliseconds(this double x) => Nanosecond.toMilliSeconds(x); - public static double NanosecondToSeconds(this double x) => Nanosecond.toSeconds(x); - public static double NanosecondToMinutes(this double x) => Nanosecond.toMinutes(x); - public static double NanosecondToHours(this double x) => Nanosecond.toHours(x); - public static double NanosecondToDays(this double x) => Nanosecond.toDays(x); - public static double NanosecondToWeeks(this double x) => Nanosecond.toWeeks(x); - public static double NanosecondToFortnights(this double x) => Nanosecond.toFortnights(x); - public static double NanosecondToMonths(this double x) => Nanosecond.toMonths(x); - public static double NanosecondToYears(this double x) => Nanosecond.toYears(x); - public static double NanosecondToDecades(this double x) => Nanosecond.toDecades(x); - public static double NanosecondToCenturies(this double x) => Nanosecond.toCenturies(x); - public static double NanosecondToMillennia(this double x) => Nanosecond.toMillennia(x); - public static double NanosecondToEons(this double x) => Nanosecond.toEons(x); -} - -public static class MicrosecondExtensions -{ - public static double MicrosecondToNanoseconds(this double x) => Microsecond.toNanoSeconds(x); - public static double MicrosecondToMilliseconds(this double x) => Microsecond.toMilliSeconds(x); - public static double MicrosecondToSeconds(this double x) => Microsecond.toSeconds(x); - public static double MicrosecondToMinutes(this double x) => Microsecond.toMinutes(x); - public static double MicrosecondToHours(this double x) => Microsecond.toHours(x); - public static double MicrosecondToDays(this double x) => Microsecond.toDays(x); - public static double MicrosecondToWeeks(this double x) => Microsecond.toWeeks(x); - public static double MicrosecondToFortnights(this double x) => Microsecond.toFortnights(x); - public static double MicrosecondToMonths(this double x) => Microsecond.toMonths(x); - public static double MicrosecondToYears(this double x) => Microsecond.toYears(x); - public static double MicrosecondToDecades(this double x) => Microsecond.toDecades(x); - public static double MicrosecondToCenturies(this double x) => Microsecond.toCenturies(x); - public static double MicrosecondToMillennia(this double x) => Microsecond.toMillennia(x); - public static double MicrosecondToEons(this double x) => Microsecond.toEons(x); -} - -public static class MillisecondExtensions -{ - public static double MillisecondToNanoseconds(this double x) => Millisecond.toNanoSeconds(x); - public static double MillisecondToMicroseconds(this double x) => Millisecond.toMicroSeconds(x); - public static double MillisecondToSeconds(this double x) => Millisecond.toSeconds(x); - public static double MillisecondToMinutes(this double x) => Millisecond.toMinutes(x); - public static double MillisecondToHours(this double x) => Millisecond.toHours(x); - public static double MillisecondToDays(this double x) => Millisecond.toDays(x); - public static double MillisecondToWeeks(this double x) => Millisecond.toWeeks(x); - public static double MillisecondToFortnights(this double x) => Millisecond.toFortnights(x); - public static double MillisecondToMonths(this double x) => Millisecond.toMonths(x); - public static double MillisecondToYears(this double x) => Millisecond.toYears(x); - public static double MillisecondToDecades(this double x) => Millisecond.toDecades(x); - public static double MillisecondToCenturies(this double x) => Millisecond.toCenturies(x); - public static double MillisecondToMillennia(this double x) => Millisecond.toMillennia(x); - public static double MillisecondToEons(this double x) => Millisecond.toEons(x); -} - -public static class SecondExtensions -{ - public static double SecondToNanoseconds(this double x) => Second.toNanoSeconds(x); - public static double SecondToMicroseconds(this double x) => Second.toMicroSeconds(x); - public static double SecondToMilliseconds(this double x) => Second.toMilliSeconds(x); - public static double SecondToMinutes(this double x) => Second.toMinutes(x); - public static double SecondToHours(this double x) => Second.toHours(x); - public static double SecondToDays(this double x) => Second.toDays(x); - public static double SecondToWeeks(this double x) => Second.toWeeks(x); - public static double SecondToFortnights(this double x) => Second.toFortnights(x); - public static double SecondToMonths(this double x) => Second.toMonths(x); - public static double SecondToYears(this double x) => Second.toYears(x); - public static double SecondToDecades(this double x) => Second.toDecades(x); - public static double SecondToCenturies(this double x) => Second.toCenturies(x); - public static double SecondToMillennia(this double x) => Second.toMillennia(x); - public static double SecondToEons(this double x) => Second.toEons(x); -} - -public static class MinuteExtensions -{ - public static double MinuteToNanoseconds(this double x) => Minute.toNanoSeconds(x); - public static double MinuteToMicroseconds(this double x) => Minute.toMicroSeconds(x); - public static double MinuteToMilliseconds(this double x) => Minute.toMilliSeconds(x); - public static double MinuteToSeconds(this double x) => Minute.toSeconds(x); - public static double MinuteToHours(this double x) => Minute.toHours(x); - public static double MinuteToDays(this double x) => Minute.toDays(x); - public static double MinuteToWeeks(this double x) => Minute.toWeeks(x); - public static double MinuteToFortnights(this double x) => Minute.toFortnights(x); - public static double MinuteToMonths(this double x) => Minute.toMonths(x); - public static double MinuteToYears(this double x) => Minute.toYears(x); - public static double MinuteToDecades(this double x) => Minute.toDecades(x); - public static double MinuteToCenturies(this double x) => Minute.toCenturies(x); - public static double MinuteToMillennia(this double x) => Minute.toMillennia(x); - public static double MinuteToEons(this double x) => Minute.toEons(x); -} - -public static class HourExtensions -{ - public static double HourToNanoseconds(this double x) => Hour.toNanoSeconds(x); - public static double HourToMicroseconds(this double x) => Hour.toMicroSeconds(x); - public static double HourToMilliseconds(this double x) => Hour.toMilliSeconds(x); - public static double HourToSeconds(this double x) => Hour.toSeconds(x); - public static double HourToMinutes(this double x) => Hour.toMinutes(x); - public static double HourToDays(this double x) => Hour.toDays(x); - public static double HourToWeeks(this double x) => Hour.toWeeks(x); - public static double HourToFortnights(this double x) => Hour.toFortnights(x); - public static double HourToMonths(this double x) => Hour.toMonths(x); - public static double HourToYears(this double x) => Hour.toYears(x); - public static double HourToDecades(this double x) => Hour.toDecades(x); - public static double HourToCenturies(this double x) => Hour.toCenturies(x); - public static double HourToMillennia(this double x) => Hour.toMillennia(x); - public static double HourToEons(this double x) => Hour.toEons(x); -} - -public static class DayExtensions -{ - public static double DayToNanoseconds(this double x) => Day.toNanoSeconds(x); - public static double DayToMicroseconds(this double x) => Day.toMicroSeconds(x); - public static double DayToMilliseconds(this double x) => Day.toMilliSeconds(x); - public static double DayToSeconds(this double x) => Day.toSeconds(x); - public static double DayToMinutes(this double x) => Day.toMinutes(x); - public static double DayToHours(this double x) => Day.toHours(x); - public static double DayToWeeks(this double x) => Day.toWeeks(x); - public static double DayToFortnights(this double x) => Day.toFortnights(x); - public static double DayToMonths(this double x) => Day.toMonths(x); - public static double DayToYears(this double x) => Day.toYears(x); - public static double DayToDecades(this double x) => Day.toDecades(x); - public static double DayToCenturies(this double x) => Day.toCenturies(x); - public static double DayToMillennia(this double x) => Day.toMillennia(x); - public static double DayToEons(this double x) => Day.toEons(x); -} - -public static class WeekExtensions -{ - public static double WeekToNanoseconds(this double x) => Week.toNanoSeconds(x); - public static double WeekToMicroseconds(this double x) => Week.toMicroSeconds(x); - public static double WeekToMilliseconds(this double x) => Week.toMilliSeconds(x); - public static double WeekToSeconds(this double x) => Week.toSeconds(x); - public static double WeekToMinutes(this double x) => Week.toMinutes(x); - public static double WeekToHours(this double x) => Week.toHours(x); - public static double WeekToDays(this double x) => Week.toDays(x); - public static double WeekToFortnights(this double x) => Week.toFortnights(x); - public static double WeekToMonths(this double x) => Week.toMonths(x); - public static double WeekToYears(this double x) => Week.toYears(x); - public static double WeekToDecades(this double x) => Week.toDecades(x); - public static double WeekToCenturies(this double x) => Week.toCenturies(x); - public static double WeekToMillennia(this double x) => Week.toMillennia(x); - public static double WeekToEons(this double x) => Week.toEons(x); -} - -public static class FortnightExtensions -{ - public static double FortnightToNanoseconds(this double x) => Fortnight.toNanoSeconds(x); - public static double FortnightToMicroseconds(this double x) => Fortnight.toMicroSeconds(x); - public static double FortnightToMilliseconds(this double x) => Fortnight.toMilliSeconds(x); - public static double FortnightToSeconds(this double x) => Fortnight.toSeconds(x); - public static double FortnightToMinutes(this double x) => Fortnight.toMinutes(x); - public static double FortnightToHours(this double x) => Fortnight.toHours(x); - public static double FortnightToDays(this double x) => Fortnight.toDays(x); - public static double FortnightToWeeks(this double x) => Fortnight.toWeeks(x); - public static double FortnightToMonths(this double x) => Fortnight.toMonths(x); - public static double FortnightToYears(this double x) => Fortnight.toYears(x); - public static double FortnightToDecades(this double x) => Fortnight.toDecades(x); - public static double FortnightToCenturies(this double x) => Fortnight.toCenturies(x); - public static double FortnightToMillennia(this double x) => Fortnight.toMillennia(x); - public static double FortnightToEons(this double x) => Fortnight.toEons(x); -} - -public static class MonthExtensions -{ - public static double MonthToNanoseconds(this double x) => Month.toNanoSeconds(x); - public static double MonthToMicroseconds(this double x) => Month.toMicroSeconds(x); - public static double MonthToMilliseconds(this double x) => Month.toMilliSeconds(x); - public static double MonthToSeconds(this double x) => Month.toSeconds(x); - public static double MonthToMinutes(this double x) => Month.toMinutes(x); - public static double MonthToHours(this double x) => Month.toHours(x); - public static double MonthToDays(this double x) => Month.toDays(x); - public static double MonthToWeeks(this double x) => Month.toWeeks(x); - public static double MonthToFortnights(this double x) => Month.toFortnights(x); - public static double MonthToYears(this double x) => Month.toYears(x); - public static double MonthToDecades(this double x) => Month.toDecades(x); - public static double MonthToCenturies(this double x) => Month.toCenturies(x); - public static double MonthToMillennia(this double x) => Month.toMillennia(x); - public static double MonthToEons(this double x) => Month.toEons(x); -} - -public static class YearExtensions -{ - public static double YearToNanoseconds(this double x) => Year.toNanoSeconds(x); - public static double YearToMicroseconds(this double x) => Year.toMicroSeconds(x); - public static double YearToMilliseconds(this double x) => Year.toMilliSeconds(x); - public static double YearToSeconds(this double x) => Year.toSeconds(x); - public static double YearToMinutes(this double x) => Year.toMinutes(x); - public static double YearToHours(this double x) => Year.toHours(x); - public static double YearToDays(this double x) => Year.toDays(x); - public static double YearToWeeks(this double x) => Year.toWeeks(x); - public static double YearToFortnights(this double x) => Year.toFortnights(x); - public static double YearToMonths(this double x) => Year.toMonths(x); - public static double YearToDecades(this double x) => Year.toDecades(x); - public static double YearToCenturies(this double x) => Year.toCenturies(x); - public static double YearToMillennia(this double x) => Year.toMillennia(x); - public static double YearToEons(this double x) => Year.toEons(x); -} - -public static class DecadeExtensions -{ - public static double DecadeToNanoseconds(this double x) => Decade.toNanoSeconds(x); - public static double DecadeToMicroseconds(this double x) => Decade.toMicroSeconds(x); - public static double DecadeToMilliseconds(this double x) => Decade.toMilliSeconds(x); - public static double DecadeToSeconds(this double x) => Decade.toSeconds(x); - public static double DecadeToMinutes(this double x) => Decade.toMinutes(x); - public static double DecadeToHours(this double x) => Decade.toHours(x); - public static double DecadeToDays(this double x) => Decade.toDays(x); - public static double DecadeToWeeks(this double x) => Decade.toWeeks(x); - public static double DecadeToFortnights(this double x) => Decade.toFortnights(x); - public static double DecadeToMonths(this double x) => Decade.toMonths(x); - public static double DecadeToYears(this double x) => Decade.toYears(x); - public static double DecadeToCenturies(this double x) => Decade.toCenturies(x); - public static double DecadeToMillennia(this double x) => Decade.toMillennia(x); - public static double DecadeToEons(this double x) => Decade.toEons(x); -} - -public static class CenturyExtensions -{ - public static double CenturyToNanoseconds(this double x) => Century.toNanoSeconds(x); - public static double CenturyToMicroseconds(this double x) => Century.toMicroSeconds(x); - public static double CenturyToMilliseconds(this double x) => Century.toMilliSeconds(x); - public static double CenturyToSeconds(this double x) => Century.toSeconds(x); - public static double CenturyToMinutes(this double x) => Century.toMinutes(x); - public static double CenturyToHours(this double x) => Century.toHours(x); - public static double CenturyToDays(this double x) => Century.toDays(x); - public static double CenturyToWeeks(this double x) => Century.toWeeks(x); - public static double CenturyToFortnights(this double x) => Century.toFortnights(x); - public static double CenturyToMonths(this double x) => Century.toMonths(x); - public static double CenturyToYears(this double x) => Century.toYears(x); - public static double CenturyToDecades(this double x) => Century.toDecades(x); - public static double CenturyToMillennia(this double x) => Century.toMillennia(x); - public static double CenturyToEons(this double x) => Century.toEons(x); -} - -public static class MillenniumExtensions -{ - public static double MillenniumToNanoseconds(this double x) => Millennium.toNanoSeconds(x); - public static double MillenniumToMicroseconds(this double x) => Millennium.toMicroSeconds(x); - public static double MillenniumToMilliseconds(this double x) => Millennium.toMilliSeconds(x); - public static double MillenniumToSeconds(this double x) => Millennium.toSeconds(x); - public static double MillenniumToMinutes(this double x) => Millennium.toMinutes(x); - public static double MillenniumToHours(this double x) => Millennium.toHours(x); - public static double MillenniumToDays(this double x) => Millennium.toDays(x); - public static double MillenniumToWeeks(this double x) => Millennium.toWeeks(x); - public static double MillenniumToFortnights(this double x) => Millennium.toFortnights(x); - public static double MillenniumToMonths(this double x) => Millennium.toMonths(x); - public static double MillenniumToYears(this double x) => Millennium.toYears(x); - public static double MillenniumToDecades(this double x) => Millennium.toDecades(x); - public static double MillenniumToCenturies(this double x) => Millennium.toCenturies(x); - public static double MillenniumToEons(this double x) => Millennium.toEons(x); -} - -public static class EonExtensions -{ - public static double EonToNanoseconds(this double x) => Eon.toNanoSeconds(x); - public static double EonToMicroseconds(this double x) => Eon.toMicroSeconds(x); - public static double EonToMilliseconds(this double x) => Eon.toMilliSeconds(x); - public static double EonToSeconds(this double x) => Eon.toSeconds(x); - public static double EonToMinutes(this double x) => Eon.toMinutes(x); - public static double EonToHours(this double x) => Eon.toHours(x); - public static double EonToDays(this double x) => Eon.toDays(x); - public static double EonToWeeks(this double x) => Eon.toWeeks(x); - public static double EonToFortnights(this double x) => Eon.toFortnights(x); - public static double EonToMonths(this double x) => Eon.toMonths(x); - public static double EonToYears(this double x) => Eon.toYears(x); - public static double EonToDecades(this double x) => Eon.toDecades(x); - public static double EonToCenturies(this double x) => Eon.toCenturies(x); - public static double EonToMillennia(this double x) => Eon.toMillennia(x); -} \ No newline at end of file diff --git a/Fs.Units.Tests.Benchmark/Program.fs b/Fs.Units.Tests.Benchmark/Program.fs deleted file mode 100644 index e05e7f3..0000000 --- a/Fs.Units.Tests.Benchmark/Program.fs +++ /dev/null @@ -1,57 +0,0 @@ -open BenchmarkDotNet.Attributes -open BenchmarkDotNet.Running -open Fs.Units.Area -open Fs.Units.Force -open Fs.Units.Force.Units -open Fs.Units.Length -open Fs.Units.Area.Units -open Fs.Units.Mass -open Fs.Units.Time - -let myTestData = [1.;2.;3.;4.;5.] -let ft2Data = - myTestData - |> List.map SquareFoot.create - -let newtonData = - myTestData - |> List.map Newton.create - -[] -type Benchmarks () = - - //ft2 to in2 - let testFunction1 (x: float) = - x * 144.0 / 1.0 - - //ft2 to in2 - let testFunction2 (x: float) = - let a = Foot.create 1 |> Foot.toInches - x * (a * a) / 1.0 - - // newton to lbf - let testFunction3 (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toPoundMass - let length = Meter.create 1 |> Meter.toFeet - let time = Second.create 1 - x * mass * length / time / time / 1.0 - - [] - member _.CompoundUnitOfMeasureConvert1 () = - ft2Data - |> List.map testFunction1 - - [] - member _.CompoundUnitOfMeasureConvert2 () = - ft2Data - |> List.map testFunction2 - - [] - member _.CompoundUnitOfMeasureConvert3 () = - newtonData - |> List.map testFunction3 - -[] -let main _ = - let _ = BenchmarkRunner.Run() - 0 \ No newline at end of file diff --git a/Fs.Units.Tests.Benchmark/paket.references b/Fs.Units.Tests.Benchmark/paket.references deleted file mode 100644 index ae048ac..0000000 --- a/Fs.Units.Tests.Benchmark/paket.references +++ /dev/null @@ -1,2 +0,0 @@ -BenchmarkDotNet -FSharp.Core \ No newline at end of file diff --git a/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs b/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs deleted file mode 100644 index d2a00dc..0000000 --- a/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs +++ /dev/null @@ -1,718 +0,0 @@ -module CompoundUnitOfMeasureTests - -open Expecto -open Fs.Units.Area -open Fs.Units.Volume -open Fs.Units.Inertia -open Fs.Units.Speed -open Fs.Units.Force -open Fs.Units.DataTransferRate -open Fs.Units.Density -open Fs.Units.Pressure -open Fs.Units.Power -open Fs.Units.Energy -open Fs.Units.ElectricCharge -open Fs.Units.ElectromotiveForce -open Fs.Units.Inductance -open Helpers - -[] -let areaTests config = - - let squareInchConversionTests = - [ - "From square inch to square feet and back", (fun x -> SquareInch.create x |> SquareInch.toSquareFeet |> SquareFoot.toSquareInches) - "From square inch to square centimeters and back", (fun x -> SquareInch.create x |> SquareInch.toSquareCentimeters |> SquareCentimeter.toSquareInches) - "From square inch to square meters and back", (fun x -> SquareInch.create x |> SquareInch.toSquareMeters |> SquareMeter.toSquareInches) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let squareFootConversionTests = - [ - "From square foot to square inches and back", (fun x -> SquareFoot.create x |> SquareFoot.toSquareInches |> SquareInch.toSquareFeet) - "From square foot to square centimeters and back", (fun x -> SquareFoot.create x |> SquareFoot.toSquareCentimeters |> SquareCentimeter.toSquareFeet) - "From square foot to square meters and back", (fun x -> SquareFoot.create x |> SquareFoot.toSquareMeters |> SquareMeter.toSquareFeet) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let squareCentimeterConversionTests = - [ - "From square centimeter to square inches and back", (fun x -> SquareCentimeter.create x |> SquareCentimeter.toSquareInches |> SquareInch.toSquareCentimeters) - "From square centimeter to square feet and back", (fun x -> SquareCentimeter.create x |> SquareCentimeter.toSquareFeet |> SquareFoot.toSquareCentimeters) - "From square centimeter to square meters and back", (fun x -> SquareCentimeter.create x |> SquareCentimeter.toSquareMeters |> SquareMeter.toSquareCentimeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let squareMeterConversionTests = - [ - "From square meter to square inches and back", (fun x -> SquareMeter.create x |> SquareMeter.toSquareInches |> SquareInch.toSquareMeters) - "From square meter to square feet and back", (fun x -> SquareMeter.create x |> SquareMeter.toSquareFeet |> SquareFoot.toSquareMeters) - "From square meter to square centimeters and back", (fun x -> SquareMeter.create x |> SquareMeter.toSquareCentimeters |> SquareCentimeter.toSquareMeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Area tests -> " [ - testList "Square inch conversion tests -> " squareInchConversionTests - testList "Square foot conversion tests -> " squareFootConversionTests - testList "Square centimeter conversion tests -> " squareCentimeterConversionTests - testList "Square meter conversion tests -> " squareMeterConversionTests - ] - -[] -let volumeTests config = - - let cubicInchConversionTests = - [ - "From cubic inch to cubic feet and back", (fun x -> CubicInch.create x |> CubicInch.toCubicFeet |> CubicFoot.toCubicInches) - "From cubic inch to cubic centimeters and back", (fun x -> CubicInch.create x |> CubicInch.toCubicCentimeters |> CubicCentimeter.toCubicInches) - "From cubic inch to cubic meters and back", (fun x -> CubicInch.create x |> CubicInch.toCubicMeters |> CubicMeter.toCubicInches) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let cubicFootConversionTests = - [ - "From cubic foot to cubic inches and back", (fun x -> CubicFoot.create x |> CubicFoot.toCubicInches |> CubicInch.toCubicFeet) - "From cubic foot to cubic centimeters and back", (fun x -> CubicFoot.create x |> CubicFoot.toCubicCentimeters |> CubicCentimeter.toCubicFeet) - "From cubic foot to cubic meters and back", (fun x -> CubicFoot.create x |> CubicFoot.toCubicMeters |> CubicMeter.toCubicFeet) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let cubicCentimeterConversionTests = - [ - "From cubic centimeter to cubic inches and back", (fun x -> CubicCentimeter.create x |> CubicCentimeter.toCubicInches |> CubicInch.toCubicCentimeters) - "From cubic centimeter to cubic feet and back", (fun x -> CubicCentimeter.create x |> CubicCentimeter.toCubicFeet |> CubicFoot.toCubicCentimeters) - "From cubic centimeter to cubic meters and back", (fun x -> CubicCentimeter.create x |> CubicCentimeter.toCubicMeters |> CubicMeter.toCubicCentimeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let cubicMeterConversionTests = - [ - "From cubic meter to cubic inches and back", (fun x -> CubicMeter.create x |> CubicMeter.toCubicInches |> CubicInch.toCubicMeters) - "From cubic meter to cubic feet and back", (fun x -> CubicMeter.create x |> CubicMeter.toCubicFeet |> CubicFoot.toCubicMeters) - "From cubic meter to cubic centimeters and back", (fun x -> CubicMeter.create x |> CubicMeter.toCubicCentimeters |> CubicCentimeter.toCubicMeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Volume tests -> " [ - testList "Cubic inch conversion tests -> " cubicInchConversionTests - testList "Cubic foot conversion tests -> " cubicFootConversionTests - testList "Cubic centimeter conversion tests -> " cubicCentimeterConversionTests - testList "Cubic meter conversion tests -> " cubicMeterConversionTests - ] - -[] -let inertiaTests config = - - let quarticInchConversionTests = - [ - "From quartic inch to quartic centimeters and back", (fun x -> QuarticInch.create x |> QuarticInch.toQuarticCentimeters |> QuarticCentimeter.toQuarticInches) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let quarticCentimeterConversionTests = - [ - "From quartic centimeter to quartic inches and back", (fun x -> QuarticCentimeter.create x |> QuarticCentimeter.toQuarticInches |> QuarticInch.toQuarticCentimeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Inertia tests -> " [ - testList "Quartic inch conversion tests -> " quarticInchConversionTests - testList "Quartic centimeter conversion tests -> " quarticCentimeterConversionTests - ] - -[] - -let speedTests config = - - let feetPerSecondTests = - [ - "From feet per second to meters per second and back", (fun x -> FootPerSecond.create x |> FootPerSecond.toMetersPerSecond |> MeterPerSecond.toFeetPerSecond) - "From feet per second to kilometers per hour and back", (fun x -> FootPerSecond.create x |> FootPerSecond.toKilometersPerHour |> KilometerPerHour.toFeetPerSecond) - "From feet per second to miles per hour and back", (fun x -> FootPerSecond.create x |> FootPerSecond.toMilesPerHour |> MilePerHour.toFeetPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let metersPerSecondTests = - [ - "From meter per second to feet per second and back", (fun x -> MeterPerSecond.create x |> MeterPerSecond.toFeetPerSecond |> FootPerSecond.toMetersPerSecond) - "From meter per second to kilometers per hour and back", (fun x -> MeterPerSecond.create x |> MeterPerSecond.toKilometersPerHour |> KilometerPerHour.toMetersPerSecond) - "From meter per second to miles per hour and back", (fun x -> MeterPerSecond.create x |> MeterPerSecond.toMilesPerHour |> MilePerHour.toMetersPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilometersPerHourTests = - [ - "From kilometer per hour to feet per second and back", (fun x -> KilometerPerHour.create x |> KilometerPerHour.toFeetPerSecond |> FootPerSecond.toKilometersPerHour) - "From kilometer per hour to meters per second and back", (fun x -> KilometerPerHour.create x |> KilometerPerHour.toMetersPerSecond |> MeterPerSecond.toKilometersPerHour) - "From kilometer per hour to miles per hour and back", (fun x -> KilometerPerHour.create x |> KilometerPerHour.toMilesPerHour |> MilePerHour.toKilometersPerHour) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let milesPerHourTests = - [ - "From mile per hour to feet per second and back", (fun x -> MilePerHour.create x |> MilePerHour.toFeetPerSecond |> FootPerSecond.toMilesPerHour) - "From mile per hour to meters per second and back", (fun x -> MilePerHour.create x |> MilePerHour.toMetersPerSecond |> MeterPerSecond.toMilesPerHour) - "From mile per hour to kilometers per hour and back", (fun x -> MilePerHour.create x |> MilePerHour.toKilometersPerHour |> KilometerPerHour.toMilesPerHour) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Speed tests -> " [ - testList "Feet per second tests -> " feetPerSecondTests - testList "Meters per second tests -> " metersPerSecondTests - testList "Kilometers per hour tests -> " kilometersPerHourTests - testList "Miles per hour tests -> " milesPerHourTests - ] - -[] -let forceTests config = - - let newtonConversionTests = - [ - "From newton to pound force and back", (fun x -> Newton.create x |> Newton.toPoundForce |> PoundForce.toNewtons) - "From newton to dynes and back", (fun x -> Newton.create x |> Newton.toDynes |> Dyne.toNewtons) - "From newton to kips and back", (fun x -> Newton.create x |> Newton.toKips |> Kip.toNewtons) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let poundForceConversionTests = - [ - "From pound force to newtons and back", (fun x -> PoundForce.create x |> PoundForce.toNewtons |> Newton.toPoundForce) - "From pound force to dynes and back", (fun x -> PoundForce.create x |> PoundForce.toDynes |> Dyne.toPoundForce) - "From pound force to kips and back", (fun x -> PoundForce.create x |> PoundForce.toKips |> Kip.toPoundForce) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let dyneConversionTests = - [ - "From dyne to newtons and back", (fun x -> Dyne.create x |> Dyne.toNewtons |> Newton.toDynes) - "From dyne to pound force and back", (fun x -> Dyne.create x |> Dyne.toPoundForce |> PoundForce.toDynes) - "From dyne to kips and back", (fun x -> Dyne.create x |> Dyne.toKips |> Kip.toDynes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kipConversionTests = - [ - "From kip to newtons and back", (fun x -> Kip.create x |> Kip.toNewtons |> Newton.toKips) - "From kip to pound force and back", (fun x -> Kip.create x |> Kip.toPoundForce |> PoundForce.toKips) - "From kip to dynes and back", (fun x -> Kip.create x |> Kip.toDynes |> Dyne.toKips) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Force tests -> " [ - testList "Newton conversion tests -> " newtonConversionTests - testList "Pound force conversion tests -> " poundForceConversionTests - testList "Dyne conversion tests -> " dyneConversionTests - testList "Kip conversion tests -> " kipConversionTests - ] - -[] -let dataTransferRateTests config = - - let baudPerSecondConversionTests = - [ - "From baud to bits per second", (fun x -> Baud.create x |> Baud.toBitsPerSecond |> BitPerSecond.toBauds) - "From baud to kilobits per second", (fun x -> Baud.create x |> Baud.toKilobitsPerSecond |> KilobitPerSecond.toBauds) - "From baud to megabits per second", (fun x -> Baud.create x |> Baud.toMegabitsPerSecond |> MegabitPerSecond.toBauds) - "From baud to gigabits per second", (fun x -> Baud.create x |> Baud.toGigabitsPerSecond |> GigabitPerSecond.toBauds) - "From baud to terabits per second", (fun x -> Baud.create x |> Baud.toTerabitsPerSecond |> TerabitPerSecond.toBauds) - "From baud to petabits per second", (fun x -> Baud.create x |> Baud.toPetabitsPerSecond |> PetabitPerSecond.toBauds) - "From baud to bytes per second", (fun x -> Baud.create x |> Baud.toBytesPerSecond |> BytePerSecond.toBauds) - "From baud to kilobytes per second", (fun x -> Baud.create x |> Baud.toKilobytesPerSecond |> KilobytePerSecond.toBauds) - "From baud to megabytes per second", (fun x -> Baud.create x |> Baud.toMegabytesPerSecond |> MegabytePerSecond.toBauds) - "From baud to gigabytes per second", (fun x -> Baud.create x |> Baud.toGigabytesPerSecond |> GigabytePerSecond.toBauds) - "From baud to terabytes per second", (fun x -> Baud.create x |> Baud.toTerabytesPerSecond |> TerabytePerSecond.toBauds) - "From baud to petabytes per second", (fun x -> Baud.create x |> Baud.toPetabytesPerSecond |> PetabytePerSecond.toBauds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let bitPerSecondConversionTests = - [ - "From bit per second to baud", (fun x -> BitPerSecond.create x |> BitPerSecond.toBauds |> Baud.toBitsPerSecond) - "From bit per second to kilobits per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toBitsPerSecond) - "From bit per second to megabits per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toBitsPerSecond) - "From bit per second to gigabits per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toBitsPerSecond) - "From bit per second to terabits per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toBitsPerSecond) - "From bit per second to petabits per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toBitsPerSecond) - "From bit per second to bytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toBytesPerSecond |> BytePerSecond.toBitsPerSecond) - "From bit per second to kilobytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toBitsPerSecond) - "From bit per second to megabytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toBitsPerSecond) - "From bit per second to gigabytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toBitsPerSecond) - "From bit per second to terabytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toTerabytesPerSecond |> TerabytePerSecond.toBitsPerSecond) - "From bit per second to petabytes per second", (fun x -> BitPerSecond.create x |> BitPerSecond.toPetabytesPerSecond |> PetabytePerSecond.toBitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilobitPerSecondConversionTests = - [ - "From kilobit per second to baud", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toBauds |> Baud.toKilobitsPerSecond) - "From kilobit per second to bits per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toBitsPerSecond |> BitPerSecond.toKilobitsPerSecond) - "From kilobit per second to megabits per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toKilobitsPerSecond) - "From kilobit per second to gigabits per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toKilobitsPerSecond) - "From kilobit per second to terabits per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toKilobitsPerSecond) - "From kilobit per second to petabits per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toKilobitsPerSecond) - "From kilobit per second to bytes per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toBytesPerSecond |> BytePerSecond.toKilobitsPerSecond) - "From kilobit per second to kilobytes per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toKilobitsPerSecond) - "From kilobit per second to megabytes per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toKilobitsPerSecond) - "From kilobit per second to gigabytes per second", (fun x -> KilobitPerSecond.create x |> KilobitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toKilobitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megabitPerSecondConversionTests = - [ - "From megabit per second to baud", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toBauds |> Baud.toMegabitsPerSecond) - "From megabit per second to bits per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toBitsPerSecond |> BitPerSecond.toMegabitsPerSecond) - "From megabit per second to kilobits per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toMegabitsPerSecond) - "From megabit per second to gigabits per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toMegabitsPerSecond) - "From megabit per second to terabits per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toMegabitsPerSecond) - "From megabit per second to petabits per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toMegabitsPerSecond) - "From megabit per second to bytes per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toBytesPerSecond |> BytePerSecond.toMegabitsPerSecond) - "From megabit per second to kilobytes per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toMegabitsPerSecond) - "From megabit per second to megabytes per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toMegabitsPerSecond) - "From megabit per second to gigabytes per second", (fun x -> MegabitPerSecond.create x |> MegabitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toMegabitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gigabitPerSecondConversionTests = - [ - "From gigabit per second to baud", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toBauds |> Baud.toGigabitsPerSecond) - "From gigabit per second to bits per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toBitsPerSecond |> BitPerSecond.toGigabitsPerSecond) - "From gigabit per second to kilobits per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toGigabitsPerSecond) - "From gigabit per second to megabits per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toGigabitsPerSecond) - "From gigabit per second to terabits per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toGigabitsPerSecond) - "From gigabit per second to petabits per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toGigabitsPerSecond) - "From gigabit per second to bytes per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toBytesPerSecond |> BytePerSecond.toGigabitsPerSecond) - "From gigabit per second to kilobytes per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toGigabitsPerSecond) - "From gigabit per second to megabytes per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toGigabitsPerSecond) - "From gigabit per second to gigabytes per second", (fun x -> GigabitPerSecond.create x |> GigabitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toGigabitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let terabitPerSecondConversionTests = - [ - "From terabit per second to baud", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toBauds |> Baud.toTerabitsPerSecond) - "From terabit per second to bits per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toBitsPerSecond |> BitPerSecond.toTerabitsPerSecond) - "From terabit per second to kilobits per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toTerabitsPerSecond) - "From terabit per second to megabits per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toTerabitsPerSecond) - "From terabit per second to gigabits per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toTerabitsPerSecond) - "From terabit per second to petabits per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toTerabitsPerSecond) - "From terabit per second to bytes per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toBytesPerSecond |> BytePerSecond.toTerabitsPerSecond) - "From terabit per second to kilobytes per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toTerabitsPerSecond) - "From terabit per second to megabytes per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toTerabitsPerSecond) - "From terabit per second to gigabytes per second", (fun x -> TerabitPerSecond.create x |> TerabitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toTerabitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let petabitPerSecondConversionTests = - [ - "From petabit per second to baud", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toBauds |> Baud.toPetabitsPerSecond) - "From petabit per second to bits per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toBitsPerSecond |> BitPerSecond.toPetabitsPerSecond) - "From petabit per second to kilobits per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toPetabitsPerSecond) - "From petabit per second to megabits per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toPetabitsPerSecond) - "From petabit per second to gigabits per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toPetabitsPerSecond) - "From petabit per second to terabits per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toPetabitsPerSecond) - "From petabit per second to bytes per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toBytesPerSecond |> BytePerSecond.toPetabitsPerSecond) - "From petabit per second to kilobytes per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toPetabitsPerSecond) - "From petabit per second to megabytes per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toPetabitsPerSecond) - "From petabit per second to gigabytes per second", (fun x -> PetabitPerSecond.create x |> PetabitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toPetabitsPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let bytePerSecondConversionTests = - [ - "From byte per second to baud", (fun x -> BytePerSecond.create x |> BytePerSecond.toBauds |> Baud.toBytesPerSecond) - "From byte per second to bits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toBitsPerSecond |> BitPerSecond.toBytesPerSecond) - "From byte per second to kilobits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toBytesPerSecond) - "From byte per second to megabits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toBytesPerSecond) - "From byte per second to gigabits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toBytesPerSecond) - "From byte per second to terabits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toBytesPerSecond) - "From byte per second to petabits per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toBytesPerSecond) - "From byte per second to kilobytes per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toBytesPerSecond) - "From byte per second to megabytes per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toBytesPerSecond) - "From byte per second to gigabytes per second", (fun x -> BytePerSecond.create x |> BytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toBytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilobytePerSecondConversionTests = - [ - "From kilobyte per second to baud", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toBauds |> Baud.toKilobytesPerSecond) - "From kilobyte per second to bits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toBitsPerSecond |> BitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to kilobits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to megabits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to gigabits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to terabits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to petabits per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toKilobytesPerSecond) - "From kilobyte per second to bytes per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toBytesPerSecond |> BytePerSecond.toKilobytesPerSecond) - "From kilobyte per second to megabytes per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toKilobytesPerSecond) - "From kilobyte per second to gigabytes per second", (fun x -> KilobytePerSecond.create x |> KilobytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toKilobytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megabytePerSecondConversionTests = - [ - "From megabyte per second to baud", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toBauds |> Baud.toMegabytesPerSecond) - "From megabyte per second to bits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toBitsPerSecond |> BitPerSecond.toMegabytesPerSecond) - "From megabyte per second to kilobits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toMegabytesPerSecond) - "From megabyte per second to megabits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toMegabytesPerSecond) - "From megabyte per second to gigabits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toMegabytesPerSecond) - "From megabyte per second to terabits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toMegabytesPerSecond) - "From megabyte per second to petabits per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toMegabytesPerSecond) - "From megabyte per second to bytes per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toBytesPerSecond |> BytePerSecond.toMegabytesPerSecond) - "From megabyte per second to kilobytes per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toMegabytesPerSecond) - "From megabyte per second to gigabytes per second", (fun x -> MegabytePerSecond.create x |> MegabytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toMegabytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gigabytePerSecondConversionTests = - [ - "From gigabyte per second to baud", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toBauds |> Baud.toGigabytesPerSecond) - "From gigabyte per second to bits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toBitsPerSecond |> BitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to kilobits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to megabits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to gigabits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to terabits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to petabits per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toGigabytesPerSecond) - "From gigabyte per second to bytes per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toBytesPerSecond |> BytePerSecond.toGigabytesPerSecond) - "From gigabyte per second to kilobytes per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toGigabytesPerSecond) - "From gigabyte per second to megabytes per second", (fun x -> GigabytePerSecond.create x |> GigabytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toGigabytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let terabytePerSecondConversionTests = - [ - "From terabyte per second to baud", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toBauds |> Baud.toTerabytesPerSecond) - "From terabyte per second to bits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toBitsPerSecond |> BitPerSecond.toTerabytesPerSecond) - "From terabyte per second to kilobits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toTerabytesPerSecond) - "From terabyte per second to megabits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toTerabytesPerSecond) - "From terabyte per second to gigabits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toTerabytesPerSecond) - "From terabyte per second to terabits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toTerabytesPerSecond) - "From terabyte per second to petabits per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toTerabytesPerSecond) - "From terabyte per second to bytes per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toBytesPerSecond |> BytePerSecond.toTerabytesPerSecond) - "From terabyte per second to kilobytes per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toTerabytesPerSecond) - "From terabyte per second to megabytes per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toTerabytesPerSecond) - "From terabyte per second to gigabytes per second", (fun x -> TerabytePerSecond.create x |> TerabytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toTerabytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let petabytePerSecondConversionTests = - [ - "From petabyte per second to baud", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toBauds |> Baud.toPetabytesPerSecond) - "From petabyte per second to bits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toBitsPerSecond |> BitPerSecond.toPetabytesPerSecond) - "From petabyte per second to kilobits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toPetabytesPerSecond) - "From petabyte per second to megabits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toPetabytesPerSecond) - "From petabyte per second to gigabits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toPetabytesPerSecond) - "From petabyte per second to terabits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toPetabytesPerSecond) - "From petabyte per second to petabits per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toPetabytesPerSecond) - "From petabyte per second to bytes per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toBytesPerSecond |> BytePerSecond.toPetabytesPerSecond) - "From petabyte per second to kilobytes per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toPetabytesPerSecond) - "From petabyte per second to megabytes per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toPetabytesPerSecond) - "From petabyte per second to gigabytes per second", (fun x -> PetabytePerSecond.create x |> PetabytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toPetabytesPerSecond) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Data transfer rate tests -> " [ - testList "Baud per second conversion tests -> " baudPerSecondConversionTests - testList "Bit per second conversion tests -> " bitPerSecondConversionTests - testList "Kilobit per second conversion tests -> " kilobitPerSecondConversionTests - testList "Megabit per second conversion tests -> " megabitPerSecondConversionTests - testList "Gigabit per second conversion tests -> " gigabitPerSecondConversionTests - testList "Terabit per second conversion tests -> " terabitPerSecondConversionTests - testList "Petabit per second conversion tests -> " petabitPerSecondConversionTests - testList "Byte per second conversion tests -> " bytePerSecondConversionTests - testList "Kilobyte per second conversion tests -> " kilobytePerSecondConversionTests - testList "Megabyte per second conversion tests -> " megabytePerSecondConversionTests - testList "Gigabyte per second conversion tests -> " gigabytePerSecondConversionTests - testList "Terabyte per second conversion tests -> " terabytePerSecondConversionTests - testList "Petabyte per second conversion tests -> " petabytePerSecondConversionTests - ] - -[] -let densityTests config = - - let kilogramPerCubicMeterConversionTests = - [ - "From kilogram per cubic meter to grams per cubic centimeter", (fun x -> KilogramPerCubicMeter.create x |> KilogramPerCubicMeter.toGramsPerCubicCentimeter |> GramPerCubicCentimeter.toKilogramsPerCubicMeter) - "From kilogram per cubic meter to pound mass per cubic foot", (fun x -> KilogramPerCubicMeter.create x |> KilogramPerCubicMeter.toPoundMassPerCubicFoot |> PoundMassPerCubicFoot.toKilogramsPerCubicMeter) - "From kilogram per cubic meter to pound mass per cubic inch", (fun x -> KilogramPerCubicMeter.create x |> KilogramPerCubicMeter.toPoundMassPerCubicInch |> PoundMassPerCubicInch.toKilogramsPerCubicMeter) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gramPerCubicCentimeterConversionTests = - [ - "From gram per cubic centimeter to kilogram per cubic meter", (fun x -> GramPerCubicCentimeter.create x |> GramPerCubicCentimeter.toKilogramsPerCubicMeter |> KilogramPerCubicMeter.toGramsPerCubicCentimeter) - "From gram per cubic centimeter to pound mass per cubic foot", (fun x -> GramPerCubicCentimeter.create x |> GramPerCubicCentimeter.toPoundMassPerCubicFoot |> PoundMassPerCubicFoot.toGramsPerCubicCentimeter) - "From gram per cubic centimeter to pound mass per cubic inch", (fun x -> GramPerCubicCentimeter.create x |> GramPerCubicCentimeter.toPoundMassPerCubicInch |> PoundMassPerCubicInch.toGramsPerCubicCentimeter) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let poundMassPerCubicFootConversionTests = - [ - "From pound mass per cubic foot to kilogram per cubic meter", (fun x -> PoundMassPerCubicFoot.create x |> PoundMassPerCubicFoot.toKilogramsPerCubicMeter |> KilogramPerCubicMeter.toPoundMassPerCubicFoot) - "From pound mass per cubic foot to grams per cubic centimeter", (fun x -> PoundMassPerCubicFoot.create x |> PoundMassPerCubicFoot.toGramsPerCubicCentimeter |> GramPerCubicCentimeter.toPoundMassPerCubicFoot) - "From pound mass per cubic foot to pound mass per cubic inch", (fun x -> PoundMassPerCubicFoot.create x |> PoundMassPerCubicFoot.toPoundMassPerCubicInch |> PoundMassPerCubicInch.toPoundMassPerCubicFoot) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let poundMassPerCubicInchConversionTests = - [ - "From pound mass per cubic inch to kilogram per cubic meter", (fun x -> PoundMassPerCubicInch.create x |> PoundMassPerCubicInch.toKilogramsPerCubicMeter |> KilogramPerCubicMeter.toPoundMassPerCubicInch) - "From pound mass per cubic inch to grams per cubic centimeter", (fun x -> PoundMassPerCubicInch.create x |> PoundMassPerCubicInch.toGramsPerCubicCentimeter |> GramPerCubicCentimeter.toPoundMassPerCubicInch) - "From pound mass per cubic inch to pound mass per cubic foot", (fun x -> PoundMassPerCubicInch.create x |> PoundMassPerCubicInch.toPoundMassPerCubicFoot |> PoundMassPerCubicFoot.toPoundMassPerCubicInch) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Density tests -> " [ - testList "Kilogram per cubic meter conversion tests -> " kilogramPerCubicMeterConversionTests - testList "Gram per cubic centimeter conversion tests -> " gramPerCubicCentimeterConversionTests - testList "Pound mass per cubic foot conversion tests -> " poundMassPerCubicFootConversionTests - testList "Pound mass per cubic inch conversion tests -> " poundMassPerCubicInchConversionTests - ] - -[] -let pressureTests config = - - let pascalConversionTests = - [ - "From pascal to pounds per square inch", (fun x -> Pascal.create x |> Pascal.toPoundsPerSquareInch |> PoundPerSquareInch.toPascals) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let poundPerSquareInchConversionTests = - [ - "From pounds per square inch to pascal", (fun x -> PoundPerSquareInch.create x |> PoundPerSquareInch.toPascals |> Pascal.toPoundsPerSquareInch) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Pressure tests -> " [ - testList "Pascal conversion tests -> " pascalConversionTests - testList "Pound per square inch conversion tests -> " poundPerSquareInchConversionTests - ] - -[] -let powerTests config = - - let wattConversionTests = - [ - "From watt to kilowatt", (fun x -> Watt.create x |> Watt.toKilowatts |> Kilowatt.toWatts) - "From watt to horsepower", (fun x -> Watt.create x |> Watt.toHorsepower |> Horsepower.toWatts) - "From watt to tons of refrigeration", (fun x -> Watt.create x |> Watt.toTonsOfRefrigeration |> TonOfRefrigeration.toWatts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilowattConversionTests = - [ - "From kilowatt to watt", (fun x -> Kilowatt.create x |> Kilowatt.toWatts |> Watt.toKilowatts) - "From kilowatt to horsepower", (fun x -> Kilowatt.create x |> Kilowatt.toHorsepower |> Horsepower.toKilowatts) - "From kilowatt to tons of refrigeration", (fun x -> Kilowatt.create x |> Kilowatt.toTonsOfRefrigeration |> TonOfRefrigeration.toKilowatts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let horsepowerConversionTests = - [ - "From horsepower to watt", (fun x -> Horsepower.create x |> Horsepower.toWatts |> Watt.toHorsepower) - "From horsepower to kiloWatt", (fun x -> Horsepower.create x |> Horsepower.toKilowatts |> Kilowatt.toHorsepower) - "From horsepower to tons of refrigeration", (fun x -> Horsepower.create x |> Horsepower.toTonsOfRefrigeration |> TonOfRefrigeration.toHorsepower) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let tonOfRefrigerationConversionTests = - [ - "From tons of refrigeration to watt", (fun x -> TonOfRefrigeration.create x |> TonOfRefrigeration.toWatts |> Watt.toTonsOfRefrigeration) - "From tons of refrigeration to kilowatt", (fun x -> TonOfRefrigeration.create x |> TonOfRefrigeration.toKilowatts |> Kilowatt.toTonsOfRefrigeration) - "From tons of refrigeration to horsepower", (fun x -> TonOfRefrigeration.create x |> TonOfRefrigeration.toHorsepower |> Horsepower.toTonsOfRefrigeration) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Power tests -> " [ - testList "Watt conversion tests -> " wattConversionTests - testList "Kilowatt conversion tests -> " kilowattConversionTests - testList "Horsepower conversion tests -> " horsepowerConversionTests - testList "Ton of refrigeration conversion tests -> " tonOfRefrigerationConversionTests - ] - -[] -let energyTests config = - - let jouleConversionTests = - [ - "From joule to kilojoule and back", (fun x -> Joule.create x |> Joule.toKilojoules |> Kilojoule.toJoules) - "From joule to british thermal units and back", (fun x -> Joule.create x |> Joule.toBritishThermalUnits |> BritishThermalUnit.toJoules) - "From joule to calories and back", (fun x -> Joule.create x |> Joule.toCalories |> Calorie.toJoules) - "From joule to quads and back", (fun x -> Joule.create x |> Joule.toQuads |> Quad.toJoules) - "From joule to Qs and back", (fun x -> Joule.create x |> Joule.toQs |> Q.toJoules) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilojouleConversionTests = - [ - "From kilojoule to joule and back", (fun x -> Kilojoule.create x |> Kilojoule.toJoules |> Joule.toKilojoules) - "From kilojoule to british thermal units and back", (fun x -> Kilojoule.create x |> Kilojoule.toBritishThermalUnits |> BritishThermalUnit.toKilojoules) - "From kilojoule to calories and back", (fun x -> Kilojoule.create x |> Kilojoule.toCalories |> Calorie.toKilojoules) - "From kilojoule to quads and back", (fun x -> Kilojoule.create x |> Kilojoule.toQuads |> Quad.toKilojoules) - "From kilojoule to Qs and back", (fun x -> Kilojoule.create x |> Kilojoule.toQs |> Q.toKilojoules) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let britishThermalUnitConversionTests = - [ - "From british thermal unit to joule and back", (fun x -> BritishThermalUnit.create x |> BritishThermalUnit.toJoules |> Joule.toBritishThermalUnits) - "From british thermal unit to kilojoule and back", (fun x -> BritishThermalUnit.create x |> BritishThermalUnit.toKilojoules |> Kilojoule.toBritishThermalUnits) - "From british thermal unit to calories and back", (fun x -> BritishThermalUnit.create x |> BritishThermalUnit.toCalories |> Calorie.toBritishThermalUnits) - "From british thermal unit to quads and back", (fun x -> BritishThermalUnit.create x |> BritishThermalUnit.toQuads |> Quad.toBritishThermalUnits) - "From british thermal unit to Qs and back", (fun x -> BritishThermalUnit.create x |> BritishThermalUnit.toQs |> Q.toBritishThermalUnits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let calorieConversionTests = - [ - "From calorie to joule and back", (fun x -> Calorie.create x |> Calorie.toJoules |> Joule.toCalories) - "From calorie to kilojoule and back", (fun x -> Calorie.create x |> Calorie.toKilojoules |> Kilojoule.toCalories) - "From calorie to british thermal units and back", (fun x -> Calorie.create x |> Calorie.toBritishThermalUnits |> BritishThermalUnit.toCalories) - "From calorie to quads and back", (fun x -> Calorie.create x |> Calorie.toQuads |> Quad.toCalories) - "From calorie to Qs and back", (fun x -> Calorie.create x |> Calorie.toQs |> Q.toCalories) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let quadConversionTests = - [ - "From quad to joule and back", (fun x -> Quad.create x |> Quad.toJoules |> Joule.toQuads) - "From quad to kilojoule and back", (fun x -> Quad.create x |> Quad.toKilojoules |> Kilojoule.toQuads) - "From quad to british thermal units and back", (fun x -> Quad.create x |> Quad.toBritishThermalUnits |> BritishThermalUnit.toQuads) - "From quad to calories and back", (fun x -> Quad.create x |> Quad.toCalories |> Calorie.toQuads) - "From quad to Qs and back", (fun x -> Quad.create x |> Quad.toQs |> Q.toQuads) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let qConversionTests = - [ - "From Q to joule and back", (fun x -> Q.create x |> Q.toJoules |> Joule.toQs) - "From Q to kilojoule and back", (fun x -> Q.create x |> Q.toKilojoules |> Kilojoule.toQs) - "From Q to british thermal units and back", (fun x -> Q.create x |> Q.toBritishThermalUnits |> BritishThermalUnit.toQs) - "From Q to calories and back", (fun x -> Q.create x |> Q.toCalories |> Calorie.toQs) - "From Q to quads and back", (fun x -> Q.create x |> Q.toQuads |> Quad.toQs) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Energy tests-> " [ - testList "Joule conversion tests-> " jouleConversionTests - testList "Kilojoule conversion tests -> " kilojouleConversionTests - testList "British thermal unit conversion tests -> " britishThermalUnitConversionTests - testList "Calorie conversion tests -> " calorieConversionTests - testList "Quad conversion tests -> " quadConversionTests - testList "Q conversion tests -> " qConversionTests - ] - -[] -let electricChargeTests config = - - let coloumbConversionTests = - [ - "From coloumb to ampere hours and back", (fun x -> Coloumb.create x |> Coloumb.toAmpereHours |> AmpereHour.toColoumbs) - "From coloumb to ampere seconds and back", (fun x -> Coloumb.create x |> Coloumb.toAmpereSeconds |> AmpereSecond.toColoumbs) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let ampereHourConversionTests = - [ - "From ampere hour to coloumbs and back", (fun x -> AmpereHour.create x |> AmpereHour.toColoumbs |> Coloumb.toAmpereHours) - "From ampere hour to ampere seconds and back", (fun x -> AmpereHour.create x |> AmpereHour.toAmpereSeconds |> AmpereSecond.toAmpereHours) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let ampereSecondConversionTests = - [ - "From ampere second to coloumbs and back", (fun x -> AmpereSecond.create x |> AmpereSecond.toColoumbs |> Coloumb.toAmpereSeconds) - "From ampere second to ampere hours and back", (fun x -> AmpereSecond.create x |> AmpereSecond.toAmpereHours |> AmpereHour.toAmpereSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Electric charge tests-> " [ - testList "Coloumb conversion tests-> " coloumbConversionTests - testList "Ampere hour conversion tests -> " ampereHourConversionTests - testList "Ampere second conversion tests -> " ampereSecondConversionTests - ] - -[] -let electromotiveForceTests config = - - let microvoltConversionTests = - [ - "From microvolt to millivolts and back", (fun x -> Microvolt.create x |> Microvolt.toMillivolts |> Millivolt.toMicrovolts) - "From microvolt to volts and back", (fun x -> Microvolt.create x |> Microvolt.toVolts |> Volt.toMicrovolts) - "From microvolt to kilovolts and back", (fun x -> Microvolt.create x |> Microvolt.toKilovolts |> Kilovolt.toMicrovolts) - "From microvolt to megavolts and back", (fun x -> Microvolt.create x |> Microvolt.toMegavolts |> Megavolt.toMicrovolts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let millivoltConversionTests = - [ - "From millivolt to microvolts and back", (fun x -> Millivolt.create x |> Millivolt.toMicrovolts |> Microvolt.toMillivolts) - "From millivolt to volts and back", (fun x -> Millivolt.create x |> Millivolt.toVolts |> Volt.toMillivolts) - "From millivolt to kilovolts and back", (fun x -> Millivolt.create x |> Millivolt.toKilovolts |> Kilovolt.toMillivolts) - "From millivolt to megavolts and back", (fun x -> Millivolt.create x |> Millivolt.toMegavolts |> Megavolt.toMillivolts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let voltConversionTests = - [ - "From volt to microvolts and back", (fun x -> Volt.create x |> Volt.toMicrovolts |> Microvolt.toVolts) - "From volt to millivolts and back", (fun x -> Volt.create x |> Volt.toMillivolts |> Millivolt.toVolts) - "From volt to kilovolts and back", (fun x -> Volt.create x |> Volt.toKilovolts |> Kilovolt.toVolts) - "From volt to megavolts and back", (fun x -> Volt.create x |> Volt.toMegavolts |> Megavolt.toVolts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilovoltConversionTests = - [ - "From kilovolt to microvolts and back", (fun x -> Kilovolt.create x |> Kilovolt.toMicrovolts |> Microvolt.toKilovolts) - "From kilovolt to millivolts and back", (fun x -> Kilovolt.create x |> Kilovolt.toMillivolts |> Millivolt.toKilovolts) - "From kilovolt to volts and back", (fun x -> Kilovolt.create x |> Kilovolt.toVolts |> Volt.toKilovolts) - "From kilovolt to megavolts and back", (fun x -> Kilovolt.create x |> Kilovolt.toMegavolts |> Megavolt.toKilovolts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megavoltConversionTests = - [ - "From megavolt to microvolts and back", (fun x -> Megavolt.create x |> Megavolt.toMicrovolts |> Microvolt.toMegavolts) - "From megavolt to millivolts and back", (fun x -> Megavolt.create x |> Megavolt.toMillivolts |> Millivolt.toMegavolts) - "From megavolt to volts and back", (fun x -> Megavolt.create x |> Megavolt.toVolts |> Volt.toMegavolts) - "From megavolt to kilovolts and back", (fun x -> Megavolt.create x |> Megavolt.toKilovolts |> Kilovolt.toMegavolts) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Electromotive force tests-> " [ - testList "Microvolt conversion tests-> " microvoltConversionTests - testList "Millivolt conversion tests -> " millivoltConversionTests - testList "Volt conversion tests -> " voltConversionTests - testList "Kilovolt conversion tests -> " kilovoltConversionTests - testList "Megavolt conversion tests -> " megavoltConversionTests - ] - -[] -let inductanceTests config = - - let microHenryConversionTest = - [ - "From micro Henry to milli Henry and back", (fun x -> MicroHenry.create x |> MicroHenry.toMilliHenrys |> MilliHenry.toMicroHenrys) - "From micro Henry to Henry and back", (fun x -> MicroHenry.create x |> MicroHenry.toHenrys |> Henry.toMicroHenrys) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let milliHenryConversionTest = - [ - "From milli Henry to micro Henry and back", (fun x -> MilliHenry.create x |> MilliHenry.toMicroHenrys |> MicroHenry.toMilliHenrys) - "From milli Henry to Henry and back", (fun x -> MilliHenry.create x |> MilliHenry.toHenrys |> Henry.toMilliHenrys) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let henryConversionTest = - [ - "From Henry to micro Henry and back", (fun x -> Henry.create x |> Henry.toMicroHenrys |> MicroHenry.toHenrys) - "From Henry to milli Henry and back", (fun x -> Henry.create x |> Henry.toMilliHenrys |> MilliHenry.toHenrys) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Inductance tests-> " [ - testList "MicroHenry conversion tests-> " microHenryConversionTest - testList "MilliHenry conversion tests -> " milliHenryConversionTest - testList "Henry conversion tests -> " henryConversionTest - ] \ No newline at end of file diff --git a/Fs.Units.Tests.Unit/Helpers.fs b/Fs.Units.Tests.Unit/Helpers.fs deleted file mode 100644 index ee0da83..0000000 --- a/Fs.Units.Tests.Unit/Helpers.fs +++ /dev/null @@ -1,24 +0,0 @@ -module Helpers - -open FsCheck -open Expecto - -let testRange f value = - let inRange v = (v > -1E+10) && (v < 1E+10) - inRange value ==> lazy (f value) - -let removeUnits<[]'u> value = float value - -let unwrapFloat a = - match a with - | NormalFloat v -> v - -let testNormalFloat x f = - let y = x |> unwrapFloat - f y - -let testConversionRoundingError config accuracy testName (f: float -> float<'Measure>) = - testPropertyWithConfig config testName <| fun (input: NormalFloat) -> - testNormalFloat input <| fun x -> - let convert = f x - Expect.floatClose accuracy (float convert) x "There is some rounding error" \ No newline at end of file diff --git a/Fs.Units.Tests.Unit/Main.fs b/Fs.Units.Tests.Unit/Main.fs deleted file mode 100644 index d124351..0000000 --- a/Fs.Units.Tests.Unit/Main.fs +++ /dev/null @@ -1,36 +0,0 @@ -module Fs.Units.Tests - -open Expecto - -[] -let main _ = - let config = FsCheckConfig.defaultConfig - - [ - SimpleUnitOfMeasureTests.lengthTests - SimpleUnitOfMeasureTests.timeTests - SimpleUnitOfMeasureTests.massTests - SimpleUnitOfMeasureTests.temperatureTests - SimpleUnitOfMeasureTests.angleTests - SimpleUnitOfMeasureTests.dataStorageTests - SimpleUnitOfMeasureTests.fuelEconomyTests - SimpleUnitOfMeasureTests.frequencyTests - SimpleUnitOfMeasureTests.illuminanceTests - SimpleUnitOfMeasureTests.currentTests - CompoundUnitOfMeasureTests.areaTests - CompoundUnitOfMeasureTests.volumeTests - CompoundUnitOfMeasureTests.inertiaTests - CompoundUnitOfMeasureTests.speedTests - CompoundUnitOfMeasureTests.forceTests - CompoundUnitOfMeasureTests.dataTransferRateTests - CompoundUnitOfMeasureTests.densityTests - CompoundUnitOfMeasureTests.pressureTests - CompoundUnitOfMeasureTests.powerTests - CompoundUnitOfMeasureTests.energyTests - CompoundUnitOfMeasureTests.electricChargeTests - CompoundUnitOfMeasureTests.electromotiveForceTests - CompoundUnitOfMeasureTests.inductanceTests - ] - |> List.map (fun x -> x config) - |> testList "Fs.Unit" - |> runTestsWithCLIArgs [] [||] \ No newline at end of file diff --git a/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs b/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs deleted file mode 100644 index 5613cda..0000000 --- a/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs +++ /dev/null @@ -1,1104 +0,0 @@ -module SimpleUnitOfMeasureTests - -open Expecto -open Fs.Units.Length -open Fs.Units.Time -open Fs.Units.Mass -open Fs.Units.Temperature -open Fs.Units.Angle -open Fs.Units.DataStorage -open Fs.Units.FuelEconomy -open Fs.Units.Frequency -open Fs.Units.Illuminance -open Fs.Units.Current -open Helpers - -[] -let lengthTests config = - let inchConversionTests = - [ - "From inch to feet and back", (fun x -> Inch.create x |> Inch.toFeet |> Foot.toInches) - "From inch to yard and back", (fun x -> Inch.create x |> Inch.toYards |> Yard.toInches) - "From inch to mile and back", (fun x -> Inch.create x |> Inch.toMiles |> Mile.toInches) - "From inch to millimeter and back", (fun x -> Inch.create x |> Inch.toMillimeters |> Millimeter.toInches) - "From inch to centimeter and back", (fun x -> Inch.create x |> Inch.toCentimeters |> Centimeter.toInches) - "From inch to meter and back", (fun x -> Inch.create x |> Inch.toMeters |> Meter.toInches) - "From inch to kilometer and back", (fun x -> Inch.create x |> Inch.toKilometers |> Kilometer.toInches) - "From inch to nautical mile and back", (fun x -> Inch.create x |> Inch.toNauticalMiles |> NauticalMile.toInches) - "From inch to chain and back", (fun x -> Inch.create x |> Inch.toChains |> Chain.toInches) - "From inch to furlong and back", (fun x -> Inch.create x |> Inch.toFurlongs |> Furlong.toInches) - "From inch to league and back", (fun x -> Inch.create x |> Inch.toLeagues |> League.toInches) - "From inch to hand and back", (fun x -> Inch.create x |> Inch.toHands |> Hand.toInches) - "From inch to rod and back", (fun x -> Inch.create x |> Inch.toRods |> Rod.toInches) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let footConversionTests = - [ - "From foot to inches and back", (fun x -> Foot.create x |> Foot.toInches |> Inch.toFeet) - "From foot to yard and back", (fun x -> Foot.create x |> Foot.toYards |> Yard.toFeet) - "From foot to mile and back", (fun x -> Foot.create x |> Foot.toMiles |> Mile.toFeet) - "From foot to millimeter and back", (fun x -> Foot.create x |> Foot.toMillimeters |> Millimeter.toFeet) - "From foot to centimeter and back", (fun x -> Foot.create x |> Foot.toCentimeters |> Centimeter.toFeet) - "From foot to meter and back", (fun x -> Foot.create x |> Foot.toMeters |> Meter.toFeet) - "From foot to kilometer and back", (fun x -> Foot.create x |> Foot.toKilometers |> Kilometer.toFeet) - "From foot to nautical mile and back", (fun x -> Foot.create x |> Foot.toNauticalMiles |> NauticalMile.toFeet) - "From foot to chain and back", (fun x -> Foot.create x |> Foot.toChains |> Chain.toFeet) - "From foot to furlong and back", (fun x -> Foot.create x |> Foot.toFurlongs |> Furlong.toFeet) - "From foot to league and back", (fun x -> Foot.create x |> Foot.toLeagues |> League.toFeet) - "From foot to hand and back", (fun x -> Foot.create x |> Foot.toHands |> Hand.toFeet) - "From foot to rod and back", (fun x -> Foot.create x |> Foot.toRods |> Rod.toFeet) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let yardConversionTests = - [ - "From yard to inches and back", (fun x -> Yard.create x |> Yard.toInches |> Inch.toYards) - "From yard to foot and back", (fun x -> Yard.create x |> Yard.toFeet |> Foot.toYards) - "From yard to mile and back", (fun x -> Yard.create x |> Yard.toMiles |> Mile.toYards) - "From yard to millimeter and back", (fun x -> Yard.create x |> Yard.toMillimeters |> Millimeter.toYards) - "From yard to centimeter and back", (fun x -> Yard.create x |> Yard.toCentimeters |> Centimeter.toYards) - "From yard to meter and back", (fun x -> Yard.create x |> Yard.toMeters |> Meter.toYards) - "From yard to kilometer and back", (fun x -> Yard.create x |> Yard.toKilometers |> Kilometer.toYards) - "From yard to nautical mile and back", (fun x -> Yard.create x |> Yard.toNauticalMiles |> NauticalMile.toYards) - "From yard to chain and back", (fun x -> Yard.create x |> Yard.toChains |> Chain.toYards) - "From yard to furlong and back", (fun x -> Yard.create x |> Yard.toFurlongs |> Furlong.toYards) - "From yard to league and back", (fun x -> Yard.create x |> Yard.toLeagues |> League.toYards) - "From yard to hand and back", (fun x -> Yard.create x |> Yard.toHands |> Hand.toYards) - "From yard to rod and back", (fun x -> Yard.create x |> Yard.toRods |> Rod.toYards) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let mileConversionTests = - [ - "From mile to inches and back", (fun x -> Mile.create x |> Mile.toInches |> Inch.toMiles) - "From mile to foot and back", (fun x -> Mile.create x |> Mile.toFeet |> Foot.toMiles) - "From mile to yard and back", (fun x -> Mile.create x |> Mile.toYards |> Yard.toMiles) - "From mile to millimeter and back", (fun x -> Mile.create x |> Mile.toMillimeters |> Millimeter.toMiles) - "From mile to centimeter and back", (fun x -> Mile.create x |> Mile.toCentimeters |> Centimeter.toMiles) - "From mile to meter and back", (fun x -> Mile.create x |> Mile.toMeters |> Meter.toMiles) - "From mile to kilometer and back", (fun x -> Mile.create x |> Mile.toKilometers |> Kilometer.toMiles) - "From mile to nautical mile and back", (fun x -> Mile.create x |> Mile.toNauticalMiles |> NauticalMile.toMiles) - "From mile to chain and back", (fun x -> Mile.create x |> Mile.toChains |> Chain.toMiles) - "From mile to furlong and back", (fun x -> Mile.create x |> Mile.toFurlongs |> Furlong.toMiles) - "From mile to league and back", (fun x -> Mile.create x |> Mile.toLeagues |> League.toMiles) - "From mile to hand and back", (fun x -> Mile.create x |> Mile.toHands |> Hand.toMiles) - "From mile to rod and back", (fun x -> Mile.create x |> Mile.toRods |> Rod.toMiles) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let millimeterConversionTests = - [ - "From millimeter to inches and back", (fun x -> Millimeter.create x |> Millimeter.toInches |> Inch.toMillimeters) - "From millimeter to foot and back", (fun x -> Millimeter.create x |> Millimeter.toFeet |> Foot.toMillimeters) - "From millimeter to yard and back", (fun x -> Millimeter.create x |> Millimeter.toYards |> Yard.toMillimeters) - "From millimeter to mile and back", (fun x -> Millimeter.create x |> Millimeter.toMiles |> Mile.toMillimeters) - "From millimeter to centimeter and back", (fun x -> Millimeter.create x |> Millimeter.toCentimeters |> Centimeter.toMillimeters) - "From millimeter to meter and back", (fun x -> Millimeter.create x |> Millimeter.toMeters |> Meter.toMillimeters) - "From millimeter to kilometer and back", (fun x -> Millimeter.create x |> Millimeter.toKilometers |> Kilometer.toMillimeters) - "From millimeter to nautical mile and back", (fun x -> Millimeter.create x |> Millimeter.toNauticalMiles |> NauticalMile.toMillimeters) - "From millimeter to chain and back", (fun x -> Millimeter.create x |> Millimeter.toChains |> Chain.toMillimeters) - "From millimeter to furlong and back", (fun x -> Millimeter.create x |> Millimeter.toFurlongs |> Furlong.toMillimeters) - "From millimeter to league and back", (fun x -> Millimeter.create x |> Millimeter.toLeagues |> League.toMillimeters) - "From millimeter to hand and back", (fun x -> Millimeter.create x |> Millimeter.toHands |> Hand.toMillimeters) - "From millimeter to rod and back", (fun x -> Millimeter.create x |> Millimeter.toRods |> Rod.toMillimeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let centimeterConversionTests = - [ - "From centimeter to inches and back", (fun x -> Centimeter.create x |> Centimeter.toInches |> Inch.toCentimeters) - "From centimeter to foot and back", (fun x -> Centimeter.create x |> Centimeter.toFeet |> Foot.toCentimeters) - "From centimeter to yard and back", (fun x -> Centimeter.create x |> Centimeter.toYards |> Yard.toCentimeters) - "From centimeter to mile and back", (fun x -> Centimeter.create x |> Centimeter.toMiles |> Mile.toCentimeters) - "From centimeter to millimeter and back", (fun x -> Centimeter.create x |> Centimeter.toMillimeters |> Millimeter.toCentimeters) - "From centimeter to meter and back", (fun x -> Centimeter.create x |> Centimeter.toMeters |> Meter.toCentimeters) - "From centimeter to kilometer and back", (fun x -> Centimeter.create x |> Centimeter.toKilometers |> Kilometer.toCentimeters) - "From centimeter to nautical mile and back", (fun x -> Centimeter.create x |> Centimeter.toNauticalMiles |> NauticalMile.toCentimeters) - "From centimeter to chain and back", (fun x -> Centimeter.create x |> Centimeter.toChains |> Chain.toCentimeters) - "From centimeter to furlong and back", (fun x -> Centimeter.create x |> Centimeter.toFurlongs |> Furlong.toCentimeters) - "From centimeter to league and back", (fun x -> Centimeter.create x |> Centimeter.toLeagues |> League.toCentimeters) - "From centimeter to hand and back", (fun x -> Centimeter.create x |> Centimeter.toHands |> Hand.toCentimeters) - "From centimeter to rod and back", (fun x -> Centimeter.create x |> Centimeter.toRods |> Rod.toCentimeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let meterConversionTests = - [ - "From meter to inches and back", (fun x -> Meter.create x |> Meter.toInches |> Inch.toMeters) - "From meter to foot and back", (fun x -> Meter.create x |> Meter.toFeet |> Foot.toMeters) - "From meter to yard and back", (fun x -> Meter.create x |> Meter.toYards |> Yard.toMeters) - "From meter to mile and back", (fun x -> Meter.create x |> Meter.toMiles |> Mile.toMeters) - "From meter to millimeter and back", (fun x -> Meter.create x |> Meter.toMillimeters |> Millimeter.toMeters) - "From meter to centimeter and back", (fun x -> Meter.create x |> Meter.toCentimeters |> Centimeter.toMeters) - "From meter to kilometer and back", (fun x -> Meter.create x |> Meter.toKilometers |> Kilometer.toMeters) - "From meter to nautical mile and back", (fun x -> Meter.create x |> Meter.toNauticalMiles |> NauticalMile.toMeters) - "From meter to chain and back", (fun x -> Meter.create x |> Meter.toChains |> Chain.toMeters) - "From meter to furlong and back", (fun x -> Meter.create x |> Meter.toFurlongs |> Furlong.toMeters) - "From meter to league and back", (fun x -> Meter.create x |> Meter.toLeagues |> League.toMeters) - "From meter to hand and back", (fun x -> Meter.create x |> Meter.toHands |> Hand.toMeters) - "From meter to rod and back", (fun x -> Meter.create x |> Meter.toRods |> Rod.toMeters) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilometerConversionTests = - [ - "From kilometer to inches and back", (fun x -> Kilometer.create x |> Kilometer.toInches |> Inch.toKilometers) - "From kilometer to foot and back", (fun x -> Kilometer.create x |> Kilometer.toFeet |> Foot.toKilometers) - "From kilometer to yard and back", (fun x -> Kilometer.create x |> Kilometer.toYards |> Yard.toKilometers) - "From kilometer to mile and back", (fun x -> Kilometer.create x |> Kilometer.toMiles |> Mile.toKilometers) - "From kilometer to millimeter and back", (fun x -> Kilometer.create x |> Kilometer.toMillimeters |> Millimeter.toKilometers) - "From kilometer to centimeter and back", (fun x -> Kilometer.create x |> Kilometer.toCentimeters |> Centimeter.toKilometers) - "From kilometer to meter and back", (fun x -> Kilometer.create x |> Kilometer.toMeters |> Meter.toKilometers) - "From kilometer to nautical mile and back", (fun x -> Kilometer.create x |> Kilometer.toNauticalMiles |> NauticalMile.toKilometers) - "From kilometer to chain and back", (fun x -> Kilometer.create x |> Kilometer.toChains |> Chain.toKilometers) - "From kilometer to furlong and back", (fun x -> Kilometer.create x |> Kilometer.toFurlongs |> Furlong.toKilometers) - "From kilometer to league and back", (fun x -> Kilometer.create x |> Kilometer.toLeagues |> League.toKilometers) - "From kilometer to hand and back", (fun x -> Kilometer.create x |> Kilometer.toHands |> Hand.toKilometers) - "From kilometer to rod and back", (fun x -> Kilometer.create x |> Kilometer.toRods |> Rod.toKilometers) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let nauticalMileConversionTests = - [ - "From nautical mile to inches and back", (fun x -> NauticalMile.create x |> NauticalMile.toInches |> Inch.toNauticalMiles) - "From nautical mile to foot and back", (fun x -> NauticalMile.create x |> NauticalMile.toFeet |> Foot.toNauticalMiles) - "From nautical mile to yard and back", (fun x -> NauticalMile.create x |> NauticalMile.toYards |> Yard.toNauticalMiles) - "From nautical mile to mile and back", (fun x -> NauticalMile.create x |> NauticalMile.toMiles |> Mile.toNauticalMiles) - "From nautical mile to millimeter and back", (fun x -> NauticalMile.create x |> NauticalMile.toMillimeters |> Millimeter.toNauticalMiles) - "From nautical mile to centimeter and back", (fun x -> NauticalMile.create x |> NauticalMile.toCentimeters |> Centimeter.toNauticalMiles) - "From nautical mile to meter and back", (fun x -> NauticalMile.create x |> NauticalMile.toMeters |> Meter.toNauticalMiles) - "From nautical mile to kilometer and back", (fun x -> NauticalMile.create x |> NauticalMile.toKilometers |> Kilometer.toNauticalMiles) - "From nautical mile to chain and back", (fun x -> NauticalMile.create x |> NauticalMile.toChains |> Chain.toNauticalMiles) - "From nautical mile to furlong and back", (fun x -> NauticalMile.create x |> NauticalMile.toFurlongs |> Furlong.toNauticalMiles) - "From nautical mile to league and back", (fun x -> NauticalMile.create x |> NauticalMile.toLeagues |> League.toNauticalMiles) - "From nautical mile to hand and back", (fun x -> NauticalMile.create x |> NauticalMile.toHands |> Hand.toNauticalMiles) - "From nautical mile to rod and back", (fun x -> NauticalMile.create x |> NauticalMile.toRods |> Rod.toNauticalMiles) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let chainConversionTests = - [ - "From chain to inches and back", (fun x -> Chain.create x |> Chain.toInches |> Inch.toChains) - "From chain to foot and back", (fun x -> Chain.create x |> Chain.toFeet |> Foot.toChains) - "From chain to yard and back", (fun x -> Chain.create x |> Chain.toYards |> Yard.toChains) - "From chain to mile and back", (fun x -> Chain.create x |> Chain.toMiles |> Mile.toChains) - "From chain to millimeter and back", (fun x -> Chain.create x |> Chain.toMillimeters |> Millimeter.toChains) - "From chain to centimeter and back", (fun x -> Chain.create x |> Chain.toCentimeters |> Centimeter.toChains) - "From chain to meter and back", (fun x -> Chain.create x |> Chain.toMeters |> Meter.toChains) - "From chain to kilometer and back", (fun x -> Chain.create x |> Chain.toKilometers |> Kilometer.toChains) - "From chain to nautical mile and back", (fun x -> Chain.create x |> Chain.toNauticalMiles |> NauticalMile.toChains) - "From chain to furlong and back", (fun x -> Chain.create x |> Chain.toFurlongs |> Furlong.toChains) - "From chain to league and back", (fun x -> Chain.create x |> Chain.toLeagues |> League.toChains) - "From chain to hand and back", (fun x -> Chain.create x |> Chain.toHands |> Hand.toChains) - "From chain to rod and back", (fun x -> Chain.create x |> Chain.toRods |> Rod.toChains) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let furlongConversionTests = - [ - "From furlong to inches and back", (fun x -> Furlong.create x |> Furlong.toInches |> Inch.toFurlongs) - "From furlong to foot and back", (fun x -> Furlong.create x |> Furlong.toFeet |> Foot.toFurlongs) - "From furlong to yard and back", (fun x -> Furlong.create x |> Furlong.toYards |> Yard.toFurlongs) - "From furlong to mile and back", (fun x -> Furlong.create x |> Furlong.toMiles |> Mile.toFurlongs) - "From furlong to millimeter and back", (fun x -> Furlong.create x |> Furlong.toMillimeters |> Millimeter.toFurlongs) - "From furlong to centimeter and back", (fun x -> Furlong.create x |> Furlong.toCentimeters |> Centimeter.toFurlongs) - "From furlong to meter and back", (fun x -> Furlong.create x |> Furlong.toMeters |> Meter.toFurlongs) - "From furlong to kilometer and back", (fun x -> Furlong.create x |> Furlong.toKilometers |> Kilometer.toFurlongs) - "From furlong to nautical mile and back", (fun x -> Furlong.create x |> Furlong.toNauticalMiles |> NauticalMile.toFurlongs) - "From furlong to chain and back", (fun x -> Furlong.create x |> Furlong.toChains |> Chain.toFurlongs) - "From furlong to league and back", (fun x -> Furlong.create x |> Furlong.toLeagues |> League.toFurlongs) - "From furlong to hand and back", (fun x -> Furlong.create x |> Furlong.toHands |> Hand.toFurlongs) - "From furlong to rod and back", (fun x -> Furlong.create x |> Furlong.toRods |> Rod.toFurlongs) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let leagueConversionTests = - [ - "From league to inches and back", (fun x -> League.create x |> League.toInches |> Inch.toLeagues) - "From league to foot and back", (fun x -> League.create x |> League.toFeet |> Foot.toLeagues) - "From league to yard and back", (fun x -> League.create x |> League.toYards |> Yard.toLeagues) - "From league to mile and back", (fun x -> League.create x |> League.toMiles |> Mile.toLeagues) - "From league to millimeter and back", (fun x -> League.create x |> League.toMillimeters |> Millimeter.toLeagues) - "From league to centimeter and back", (fun x -> League.create x |> League.toCentimeters |> Centimeter.toLeagues) - "From league to meter and back", (fun x -> League.create x |> League.toMeters |> Meter.toLeagues) - "From league to kilometer and back", (fun x -> League.create x |> League.toKilometers |> Kilometer.toLeagues) - "From league to nautical mile and back", (fun x -> League.create x |> League.toNauticalMiles |> NauticalMile.toLeagues) - "From league to chain and back", (fun x -> League.create x |> League.toChains |> Chain.toLeagues) - "From league to furlong and back", (fun x -> League.create x |> League.toFurlongs |> Furlong.toLeagues) - "From league to hand and back", (fun x -> League.create x |> League.toHands |> Hand.toLeagues) - "From league to rod and back", (fun x -> League.create x |> League.toRods |> Rod.toLeagues) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let handConversionTests = - [ - "From hand to inches and back", (fun x -> Hand.create x |> Hand.toInches |> Inch.toHands) - "From hand to foot and back", (fun x -> Hand.create x |> Hand.toFeet |> Foot.toHands) - "From hand to yard and back", (fun x -> Hand.create x |> Hand.toYards |> Yard.toHands) - "From hand to mile and back", (fun x -> Hand.create x |> Hand.toMiles |> Mile.toHands) - "From hand to millimeter and back", (fun x -> Hand.create x |> Hand.toMillimeters |> Millimeter.toHands) - "From hand to centimeter and back", (fun x -> Hand.create x |> Hand.toCentimeters |> Centimeter.toHands) - "From hand to meter and back", (fun x -> Hand.create x |> Hand.toMeters |> Meter.toHands) - "From hand to kilometer and back", (fun x -> Hand.create x |> Hand.toKilometers |> Kilometer.toHands) - "From hand to nautical mile and back", (fun x -> Hand.create x |> Hand.toNauticalMiles |> NauticalMile.toHands) - "From hand to chain and back", (fun x -> Hand.create x |> Hand.toChains |> Chain.toHands) - "From hand to furlong and back", (fun x -> Hand.create x |> Hand.toFurlongs |> Furlong.toHands) - "From hand to league and back", (fun x -> Hand.create x |> Hand.toLeagues |> League.toHands) - "From hand to rod and back", (fun x -> Hand.create x |> Hand.toRods |> Rod.toHands) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let rodConversionTests = - [ - "From rod to inches and back", (fun x -> Rod.create x |> Rod.toInches |> Inch.toRods) - "From rod to foot and back", (fun x -> Rod.create x |> Rod.toFeet |> Foot.toRods) - "From rod to yard and back", (fun x -> Rod.create x |> Rod.toYards |> Yard.toRods) - "From rod to mile and back", (fun x -> Rod.create x |> Rod.toMiles |> Mile.toRods) - "From rod to millimeter and back", (fun x -> Rod.create x |> Rod.toMillimeters |> Millimeter.toRods) - "From rod to centimeter and back", (fun x -> Rod.create x |> Rod.toCentimeters |> Centimeter.toRods) - "From rod to meter and back", (fun x -> Rod.create x |> Rod.toMeters |> Meter.toRods) - "From rod to kilometer and back", (fun x -> Rod.create x |> Rod.toKilometers |> Kilometer.toRods) - "From rod to nautical mile and back", (fun x -> Rod.create x |> Rod.toNauticalMiles |> NauticalMile.toRods) - "From rod to chain and back", (fun x -> Rod.create x |> Rod.toChains |> Chain.toRods) - "From rod to furlong and back", (fun x -> Rod.create x |> Rod.toFurlongs |> Furlong.toRods) - "From rod to league and back", (fun x -> Rod.create x |> Rod.toLeagues |> League.toRods) - "From rod to hand and back", (fun x -> Rod.create x |> Rod.toHands |> Hand.toRods) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Length Tests -> " [ - testList "Convert inch to other and back -> " inchConversionTests - testList "Convert foot to other and back -> " footConversionTests - testList "Convert yard to other and back -> " yardConversionTests - testList "Convert mile to other and back -> " mileConversionTests - testList "Convert millimeter to other and back -> " millimeterConversionTests - testList "Convert centimeter to other and back -> " centimeterConversionTests - testList "Convert meter to other and back -> " meterConversionTests - testList "Convert kilometer to other and back -> " kilometerConversionTests - testList "Convert nautical mile to other and back -> " nauticalMileConversionTests - testList "Convert chain to other and back -> " chainConversionTests - testList "Convert furlong to other and back -> " furlongConversionTests - testList "Convert league to other and back -> " leagueConversionTests - testList "Convert hand to other and back -> " handConversionTests - testList "Convert rod to other and back -> " rodConversionTests - ] - -[] -let timeTests config = - - let nanoSecondConversionTests = - [ - "From nanosecond to microsecond and back", (fun x -> Nanosecond.create x |> Nanosecond.toMicroSeconds |> Microsecond.toNanoSeconds) - "From nanosecond to millisecond and back", (fun x -> Nanosecond.create x |> Nanosecond.toMilliSeconds |> Millisecond.toNanoSeconds) - "From nanosecond to second and back", (fun x -> Nanosecond.create x |> Nanosecond.toSeconds |> Second.toNanoSeconds) - "From nanosecond to minute and back", (fun x -> Nanosecond.create x |> Nanosecond.toMinutes |> Minute.toNanoSeconds) - "From nanosecond to hour and back", (fun x -> Nanosecond.create x |> Nanosecond.toHours |> Hour.toNanoSeconds) - "From nanosecond to day and back", (fun x -> Nanosecond.create x |> Nanosecond.toDays |> Day.toNanoSeconds) - "From nanosecond to week and back", (fun x -> Nanosecond.create x |> Nanosecond.toWeeks |> Week.toNanoSeconds) - "From nanosecond to fortnight and back", (fun x -> Nanosecond.create x |> Nanosecond.toFortnights |> Fortnight.toNanoSeconds) - "From nanosecond to month and back", (fun x -> Nanosecond.create x |> Nanosecond.toMonths |> Month.toNanoSeconds) - "From nanosecond to year and back", (fun x -> Nanosecond.create x |> Nanosecond.toYears |> Year.toNanoSeconds) - "From nanosecond to decade and back", (fun x -> Nanosecond.create x |> Nanosecond.toDecades |> Decade.toNanoSeconds) - "From nanosecond to century and back", (fun x -> Nanosecond.create x |> Nanosecond.toCenturies |> Century.toNanoSeconds) - "From nanosecond to millennium and back", (fun x -> Nanosecond.create x |> Nanosecond.toMillennia |> Millennium.toNanoSeconds) - "From nanosecond to eon and back", (fun x -> Nanosecond.create x |> Nanosecond.toEons |> Eon.toNanoSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let microSecondConversionTests = - [ - "From microsecond to nanosecond and back", (fun x -> Microsecond.create x |> Microsecond.toNanoSeconds |> Nanosecond.toMicroSeconds) - "From microsecond to millisecond and back", (fun x -> Microsecond.create x |> Microsecond.toMilliSeconds |> Millisecond.toMicroSeconds) - "From microsecond to second and back", (fun x -> Microsecond.create x |> Microsecond.toSeconds |> Second.toMicroSeconds) - "From microsecond to minute and back", (fun x -> Microsecond.create x |> Microsecond.toMinutes |> Minute.toMicroSeconds) - "From microsecond to hour and back", (fun x -> Microsecond.create x |> Microsecond.toHours |> Hour.toMicroSeconds) - "From microsecond to day and back", (fun x -> Microsecond.create x |> Microsecond.toDays |> Day.toMicroSeconds) - "From microsecond to week and back", (fun x -> Microsecond.create x |> Microsecond.toWeeks |> Week.toMicroSeconds) - "From microsecond to fortnight and back", (fun x -> Microsecond.create x |> Microsecond.toFortnights |> Fortnight.toMicroSeconds) - "From microsecond to month and back", (fun x -> Microsecond.create x |> Microsecond.toMonths |> Month.toMicroSeconds) - "From microsecond to year and back", (fun x -> Microsecond.create x |> Microsecond.toYears |> Year.toMicroSeconds) - "From microsecond to decade and back", (fun x -> Microsecond.create x |> Microsecond.toDecades |> Decade.toMicroSeconds) - "From microsecond to century and back", (fun x -> Microsecond.create x |> Microsecond.toCenturies |> Century.toMicroSeconds) - "From microsecond to millennium and back", (fun x -> Microsecond.create x |> Microsecond.toMillennia |> Millennium.toMicroSeconds) - "From microsecond to eon and back", (fun x -> Microsecond.create x |> Microsecond.toEons |> Eon.toMicroSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let milliSecondConversionTests = - [ - "From millisecond to nanosecond and back", (fun x -> Millisecond.create x |> Millisecond.toNanoSeconds |> Nanosecond.toMilliSeconds) - "From millisecond to microsecond and back", (fun x -> Millisecond.create x |> Millisecond.toMicroSeconds |> Microsecond.toMilliSeconds) - "From millisecond to second and back", (fun x -> Millisecond.create x |> Millisecond.toSeconds |> Second.toMilliSeconds) - "From millisecond to minute and back", (fun x -> Millisecond.create x |> Millisecond.toMinutes |> Minute.toMilliSeconds) - "From millisecond to hour and back", (fun x -> Millisecond.create x |> Millisecond.toHours |> Hour.toMilliSeconds) - "From millisecond to day and back", (fun x -> Millisecond.create x |> Millisecond.toDays |> Day.toMilliSeconds) - "From millisecond to week and back", (fun x -> Millisecond.create x |> Millisecond.toWeeks |> Week.toMilliSeconds) - "From millisecond to fortnight and back", (fun x -> Millisecond.create x |> Millisecond.toFortnights |> Fortnight.toMilliSeconds) - "From millisecond to month and back", (fun x -> Millisecond.create x |> Millisecond.toMonths |> Month.toMilliSeconds) - "From millisecond to year and back", (fun x -> Millisecond.create x |> Millisecond.toYears |> Year.toMilliSeconds) - "From millisecond to decade and back", (fun x -> Millisecond.create x |> Millisecond.toDecades |> Decade.toMilliSeconds) - "From millisecond to century and back", (fun x -> Millisecond.create x |> Millisecond.toCenturies |> Century.toMilliSeconds) - "From millisecond to millennium and back", (fun x -> Millisecond.create x |> Millisecond.toMillennia |> Millennium.toMilliSeconds) - "From millisecond to eon and back", (fun x -> Millisecond.create x |> Millisecond.toEons |> Eon.toMilliSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let secondConversionTests = - [ - "From second to nanosecond and back", (fun x -> Second.create x |> Second.toNanoSeconds |> Nanosecond.toSeconds) - "From second to microsecond and back", (fun x -> Second.create x |> Second.toMicroSeconds |> Microsecond.toSeconds) - "From second to millisecond and back", (fun x -> Second.create x |> Second.toMilliSeconds |> Millisecond.toSeconds) - "From second to minute and back", (fun x -> Second.create x |> Second.toMinutes |> Minute.toSeconds) - "From second to hour and back", (fun x -> Second.create x |> Second.toHours |> Hour.toSeconds) - "From second to day and back", (fun x -> Second.create x |> Second.toDays |> Day.toSeconds) - "From second to week and back", (fun x -> Second.create x |> Second.toWeeks |> Week.toSeconds) - "From second to fortnight and back", (fun x -> Second.create x |> Second.toFortnights |> Fortnight.toSeconds) - "From second to month and back", (fun x -> Second.create x |> Second.toMonths |> Month.toSeconds) - "From second to year and back", (fun x -> Second.create x |> Second.toYears |> Year.toSeconds) - "From second to decade and back", (fun x -> Second.create x |> Second.toDecades |> Decade.toSeconds) - "From second to century and back", (fun x -> Second.create x |> Second.toCenturies |> Century.toSeconds) - "From second to millennium and back", (fun x -> Second.create x |> Second.toMillennia |> Millennium.toSeconds) - "From second to eon and back", (fun x -> Second.create x |> Second.toEons |> Eon.toSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let minuteConversionTests = - [ - "From minute to nanosecond and back", (fun x -> Minute.create x |> Minute.toNanoSeconds |> Nanosecond.toMinutes) - "From minute to microsecond and back", (fun x -> Minute.create x |> Minute.toMicroSeconds |> Microsecond.toMinutes) - "From minute to millisecond and back", (fun x -> Minute.create x |> Minute.toMilliSeconds |> Millisecond.toMinutes) - "From minute to second and back", (fun x -> Minute.create x |> Minute.toSeconds |> Second.toMinutes) - "From minute to hour and back", (fun x -> Minute.create x |> Minute.toHours |> Hour.toMinutes) - "From minute to day and back", (fun x -> Minute.create x |> Minute.toDays |> Day.toMinutes) - "From minute to week and back", (fun x -> Minute.create x |> Minute.toWeeks |> Week.toMinutes) - "From minute to fortnight and back", (fun x -> Minute.create x |> Minute.toFortnights |> Fortnight.toMinutes) - "From minute to month and back", (fun x -> Minute.create x |> Minute.toMonths |> Month.toMinutes) - "From minute to year and back", (fun x -> Minute.create x |> Minute.toYears |> Year.toMinutes) - "From minute to decade and back", (fun x -> Minute.create x |> Minute.toDecades |> Decade.toMinutes) - "From minute to century and back", (fun x -> Minute.create x |> Minute.toCenturies |> Century.toMinutes) - "From minute to millennium and back", (fun x -> Minute.create x |> Minute.toMillennia |> Millennium.toMinutes) - "From minute to eon and back", (fun x -> Minute.create x |> Minute.toEons |> Eon.toMinutes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let hourConversionTests = - [ - "From hour to nanosecond and back", (fun x -> Hour.create x |> Hour.toNanoSeconds |> Nanosecond.toHours) - "From hour to microsecond and back", (fun x -> Hour.create x |> Hour.toMicroSeconds |> Microsecond.toHours) - "From hour to millisecond and back", (fun x -> Hour.create x |> Hour.toMilliSeconds |> Millisecond.toHours) - "From hour to second and back", (fun x -> Hour.create x |> Hour.toSeconds |> Second.toHours) - "From hour to minute and back", (fun x -> Hour.create x |> Hour.toMinutes |> Minute.toHours) - "From hour to day and back", (fun x -> Hour.create x |> Hour.toDays |> Day.toHours) - "From hour to week and back", (fun x -> Hour.create x |> Hour.toWeeks |> Week.toHours) - "From hour to fortnight and back", (fun x -> Hour.create x |> Hour.toFortnights |> Fortnight.toHours) - "From hour to month and back", (fun x -> Hour.create x |> Hour.toMonths |> Month.toHours) - "From hour to year and back", (fun x -> Hour.create x |> Hour.toYears |> Year.toHours) - "From hour to decade and back", (fun x -> Hour.create x |> Hour.toDecades |> Decade.toHours) - "From hour to century and back", (fun x -> Hour.create x |> Hour.toCenturies |> Century.toHours) - "From hour to millennium and back", (fun x -> Hour.create x |> Hour.toMillennia |> Millennium.toHours) - "From hour to eon and back", (fun x -> Hour.create x |> Hour.toEons |> Eon.toHours) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let dayConversionTests = - [ - "From day to nanosecond and back", (fun x -> Day.create x |> Day.toNanoSeconds |> Nanosecond.toDays) - "From day to microsecond and back", (fun x -> Day.create x |> Day.toMicroSeconds |> Microsecond.toDays) - "From day to millisecond and back", (fun x -> Day.create x |> Day.toMilliSeconds |> Millisecond.toDays) - "From day to second and back", (fun x -> Day.create x |> Day.toSeconds |> Second.toDays) - "From day to minute and back", (fun x -> Day.create x |> Day.toMinutes |> Minute.toDays) - "From day to hour and back", (fun x -> Day.create x |> Day.toHours |> Hour.toDays) - "From day to week and back", (fun x -> Day.create x |> Day.toWeeks |> Week.toDays) - "From day to fortnight and back", (fun x -> Day.create x |> Day.toFortnights |> Fortnight.toDays) - "From day to month and back", (fun x -> Day.create x |> Day.toMonths |> Month.toDays) - "From day to year and back", (fun x -> Day.create x |> Day.toYears |> Year.toDays) - "From day to decade and back", (fun x -> Day.create x |> Day.toDecades |> Decade.toDays) - "From day to century and back", (fun x -> Day.create x |> Day.toCenturies |> Century.toDays) - "From day to millennium and back", (fun x -> Day.create x |> Day.toMillennia |> Millennium.toDays) - "From day to eon and back", (fun x -> Day.create x |> Day.toEons |> Eon.toDays) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let weekConversionTests = - [ - "From week to nanosecond and back", (fun x -> Week.create x |> Week.toNanoSeconds |> Nanosecond.toWeeks) - "From week to microsecond and back", (fun x -> Week.create x |> Week.toMicroSeconds |> Microsecond.toWeeks) - "From week to millisecond and back", (fun x -> Week.create x |> Week.toMilliSeconds |> Millisecond.toWeeks) - "From week to second and back", (fun x -> Week.create x |> Week.toSeconds |> Second.toWeeks) - "From week to minute and back", (fun x -> Week.create x |> Week.toMinutes |> Minute.toWeeks) - "From week to hour and back", (fun x -> Week.create x |> Week.toHours |> Hour.toWeeks) - "From week to day and back", (fun x -> Week.create x |> Week.toDays |> Day.toWeeks) - "From week to fortnight and back", (fun x -> Week.create x |> Week.toFortnights |> Fortnight.toWeeks) - "From week to month and back", (fun x -> Week.create x |> Week.toMonths |> Month.toWeeks) - "From week to year and back", (fun x -> Week.create x |> Week.toYears |> Year.toWeeks) - "From week to decade and back", (fun x -> Week.create x |> Week.toDecades |> Decade.toWeeks) - "From week to century and back", (fun x -> Week.create x |> Week.toCenturies |> Century.toWeeks) - "From week to millennium and back", (fun x -> Week.create x |> Week.toMillennia |> Millennium.toWeeks) - "From week to eon and back", (fun x -> Week.create x |> Week.toEons |> Eon.toWeeks) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let fortnightConversionTests = - [ - "From fortnight to nanosecond and back", (fun x -> Fortnight.create x |> Fortnight.toNanoSeconds |> Nanosecond.toFortnights) - "From fortnight to microsecond and back", (fun x -> Fortnight.create x |> Fortnight.toMicroSeconds |> Microsecond.toFortnights) - "From fortnight to millisecond and back", (fun x -> Fortnight.create x |> Fortnight.toMilliSeconds |> Millisecond.toFortnights) - "From fortnight to second and back", (fun x -> Fortnight.create x |> Fortnight.toSeconds |> Second.toFortnights) - "From fortnight to minute and back", (fun x -> Fortnight.create x |> Fortnight.toMinutes |> Minute.toFortnights) - "From fortnight to hour and back", (fun x -> Fortnight.create x |> Fortnight.toHours |> Hour.toFortnights) - "From fortnight to day and back", (fun x -> Fortnight.create x |> Fortnight.toDays |> Day.toFortnights) - "From fortnight to week and back", (fun x -> Fortnight.create x |> Fortnight.toWeeks |> Week.toFortnights) - "From fortnight to month and back", (fun x -> Fortnight.create x |> Fortnight.toMonths |> Month.toFortnights) - "From fortnight to year and back", (fun x -> Fortnight.create x |> Fortnight.toYears |> Year.toFortnights) - "From fortnight to decade and back", (fun x -> Fortnight.create x |> Fortnight.toDecades |> Decade.toFortnights) - "From fortnight to century and back", (fun x -> Fortnight.create x |> Fortnight.toCenturies |> Century.toFortnights) - "From fortnight to millennium and back", (fun x -> Fortnight.create x |> Fortnight.toMillennia |> Millennium.toFortnights) - "From fortnight to eon and back", (fun x -> Fortnight.create x |> Fortnight.toEons |> Eon.toFortnights) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let monthConversionTests = - [ - "From month to nanosecond and back", (fun x -> Month.create x |> Month.toNanoSeconds |> Nanosecond.toMonths) - "From month to microsecond and back", (fun x -> Month.create x |> Month.toMicroSeconds |> Microsecond.toMonths) - "From month to millisecond and back", (fun x -> Month.create x |> Month.toMilliSeconds |> Millisecond.toMonths) - "From month to second and back", (fun x -> Month.create x |> Month.toSeconds |> Second.toMonths) - "From month to minute and back", (fun x -> Month.create x |> Month.toMinutes |> Minute.toMonths) - "From month to hour and back", (fun x -> Month.create x |> Month.toHours |> Hour.toMonths) - "From month to day and back", (fun x -> Month.create x |> Month.toDays |> Day.toMonths) - "From month to week and back", (fun x -> Month.create x |> Month.toWeeks |> Week.toMonths) - "From month to fortnight and back", (fun x -> Month.create x |> Month.toFortnights |> Fortnight.toMonths) - "From month to year and back", (fun x -> Month.create x |> Month.toYears |> Year.toMonths) - "From month to decade and back", (fun x -> Month.create x |> Month.toDecades |> Decade.toMonths) - "From month to century and back", (fun x -> Month.create x |> Month.toCenturies |> Century.toMonths) - "From month to millennium and back", (fun x -> Month.create x |> Month.toMillennia |> Millennium.toMonths) - "From month to eon and back", (fun x -> Month.create x |> Month.toEons |> Eon.toMonths) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let yearConversionTests = - [ - "From year to nanosecond and back", (fun x -> Year.create x |> Year.toNanoSeconds |> Nanosecond.toYears) - "From year to microsecond and back", (fun x -> Year.create x |> Year.toMicroSeconds |> Microsecond.toYears) - "From year to millisecond and back", (fun x -> Year.create x |> Year.toMilliSeconds |> Millisecond.toYears) - "From year to second and back", (fun x -> Year.create x |> Year.toSeconds |> Second.toYears) - "From year to minute and back", (fun x -> Year.create x |> Year.toMinutes |> Minute.toYears) - "From year to hour and back", (fun x -> Year.create x |> Year.toHours |> Hour.toYears) - "From year to day and back", (fun x -> Year.create x |> Year.toDays |> Day.toYears) - "From year to week and back", (fun x -> Year.create x |> Year.toWeeks |> Week.toYears) - "From year to fortnight and back", (fun x -> Year.create x |> Year.toFortnights |> Fortnight.toYears) - "From year to month and back", (fun x -> Year.create x |> Year.toMonths |> Month.toYears) - "From year to decade and back", (fun x -> Year.create x |> Year.toDecades |> Decade.toYears) - "From year to century and back", (fun x -> Year.create x |> Year.toCenturies |> Century.toYears) - "From year to millennium and back", (fun x -> Year.create x |> Year.toMillennia |> Millennium.toYears) - "From year to eon and back", (fun x -> Year.create x |> Year.toEons |> Eon.toYears) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let decadeConversionTests = - [ - "From decade to nanosecond and back", (fun x -> Decade.create x |> Decade.toNanoSeconds |> Nanosecond.toDecades) - "From decade to microsecond and back", (fun x -> Decade.create x |> Decade.toMicroSeconds |> Microsecond.toDecades) - "From decade to millisecond and back", (fun x -> Decade.create x |> Decade.toMilliSeconds |> Millisecond.toDecades) - "From decade to second and back", (fun x -> Decade.create x |> Decade.toSeconds |> Second.toDecades) - "From decade to minute and back", (fun x -> Decade.create x |> Decade.toMinutes |> Minute.toDecades) - "From decade to hour and back", (fun x -> Decade.create x |> Decade.toHours |> Hour.toDecades) - "From decade to day and back", (fun x -> Decade.create x |> Decade.toDays |> Day.toDecades) - "From decade to week and back", (fun x -> Decade.create x |> Decade.toWeeks |> Week.toDecades) - "From decade to fortnight and back", (fun x -> Decade.create x |> Decade.toFortnights |> Fortnight.toDecades) - "From decade to month and back", (fun x -> Decade.create x |> Decade.toMonths |> Month.toDecades) - "From decade to year and back", (fun x -> Decade.create x |> Decade.toYears |> Year.toDecades) - "From decade to century and back", (fun x -> Decade.create x |> Decade.toCenturies |> Century.toDecades) - "From decade to millennium and back", (fun x -> Decade.create x |> Decade.toMillennia |> Millennium.toDecades) - "From decade to eon and back", (fun x -> Decade.create x |> Decade.toEons |> Eon.toDecades) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let centuryConversionTests = - [ - "From century to nanosecond and back", (fun x -> Century.create x |> Century.toNanoSeconds |> Nanosecond.toCenturies) - "From century to microsecond and back", (fun x -> Century.create x |> Century.toMicroSeconds |> Microsecond.toCenturies) - "From century to millisecond and back", (fun x -> Century.create x |> Century.toMilliSeconds |> Millisecond.toCenturies) - "From century to second and back", (fun x -> Century.create x |> Century.toSeconds |> Second.toCenturies) - "From century to minute and back", (fun x -> Century.create x |> Century.toMinutes |> Minute.toCenturies) - "From century to hour and back", (fun x -> Century.create x |> Century.toHours |> Hour.toCenturies) - "From century to day and back", (fun x -> Century.create x |> Century.toDays |> Day.toCenturies) - "From century to week and back", (fun x -> Century.create x |> Century.toWeeks |> Week.toCenturies) - "From century to fortnight and back", (fun x -> Century.create x |> Century.toFortnights |> Fortnight.toCenturies) - "From century to month and back", (fun x -> Century.create x |> Century.toMonths |> Month.toCenturies) - "From century to year and back", (fun x -> Century.create x |> Century.toYears |> Year.toCenturies) - "From century to decade and back", (fun x -> Century.create x |> Century.toDecades |> Decade.toCenturies) - "From century to millennium and back", (fun x -> Century.create x |> Century.toMillennia |> Millennium.toCenturies) - "From century to eon and back", (fun x -> Century.create x |> Century.toEons |> Eon.toCenturies) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let millenniumConversionTests = - [ - "From millennium to nanosecond and back", (fun x -> Millennium.create x |> Millennium.toNanoSeconds |> Nanosecond.toMillennia) - "From millennium to microsecond and back", (fun x -> Millennium.create x |> Millennium.toMicroSeconds |> Microsecond.toMillennia) - "From millennium to millisecond and back", (fun x -> Millennium.create x |> Millennium.toMilliSeconds |> Millisecond.toMillennia) - "From millennium to second and back", (fun x -> Millennium.create x |> Millennium.toSeconds |> Second.toMillennia) - "From millennium to minute and back", (fun x -> Millennium.create x |> Millennium.toMinutes |> Minute.toMillennia) - "From millennium to hour and back", (fun x -> Millennium.create x |> Millennium.toHours |> Hour.toMillennia) - "From millennium to day and back", (fun x -> Millennium.create x |> Millennium.toDays |> Day.toMillennia) - "From millennium to week and back", (fun x -> Millennium.create x |> Millennium.toWeeks |> Week.toMillennia) - "From millennium to fortnight and back", (fun x -> Millennium.create x |> Millennium.toFortnights |> Fortnight.toMillennia) - "From millennium to month and back", (fun x -> Millennium.create x |> Millennium.toMonths |> Month.toMillennia) - "From millennium to year and back", (fun x -> Millennium.create x |> Millennium.toYears |> Year.toMillennia) - "From millennium to decade and back", (fun x -> Millennium.create x |> Millennium.toDecades |> Decade.toMillennia) - "From millennium to century and back", (fun x -> Millennium.create x |> Millennium.toCenturies |> Century.toMillennia) - "From millennium to eon and back", (fun x -> Millennium.create x |> Millennium.toEons |> Eon.toMillennia) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let eonConversionTests = - [ - "From eon to nanosecond and back", (fun x -> Eon.create x |> Eon.toNanoSeconds |> Nanosecond.toEons) - "From eon to microsecond and back", (fun x -> Eon.create x |> Eon.toMicroSeconds |> Microsecond.toEons) - "From eon to millisecond and back", (fun x -> Eon.create x |> Eon.toMilliSeconds |> Millisecond.toEons) - "From eon to second and back", (fun x -> Eon.create x |> Eon.toSeconds |> Second.toEons) - "From eon to minute and back", (fun x -> Eon.create x |> Eon.toMinutes |> Minute.toEons) - "From eon to hour and back", (fun x -> Eon.create x |> Eon.toHours |> Hour.toEons) - "From eon to day and back", (fun x -> Eon.create x |> Eon.toDays |> Day.toEons) - "From eon to week and back", (fun x -> Eon.create x |> Eon.toWeeks |> Week.toEons) - "From eon to fortnight and back", (fun x -> Eon.create x |> Eon.toFortnights |> Fortnight.toEons) - "From eon to month and back", (fun x -> Eon.create x |> Eon.toMonths |> Month.toEons) - "From eon to year and back", (fun x -> Eon.create x |> Eon.toYears |> Year.toEons) - "From eon to decade and back", (fun x -> Eon.create x |> Eon.toDecades |> Decade.toEons) - "From eon to century and back", (fun x -> Eon.create x |> Eon.toCenturies |> Century.toEons) - "From eon to millennium and back", (fun x -> Eon.create x |> Eon.toMillennia |> Millennium.toEons) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - - testList "Time Tests -> " [ - testList "Nanosecond conversion tests -> " nanoSecondConversionTests - testList "Microsecond conversion tests -> " microSecondConversionTests - testList "Millisecond conversion tests -> " milliSecondConversionTests - testList "Second conversion tests -> " secondConversionTests - testList "Minute conversion tests -> " minuteConversionTests - testList "Hour conversion tests -> " hourConversionTests - testList "Day conversion tests -> " dayConversionTests - testList "Week conversion tests -> " weekConversionTests - testList "Fortnight conversion tests -> " fortnightConversionTests - testList "Month conversion tests -> " monthConversionTests - testList "Year conversion tests -> " yearConversionTests - testList "Decade conversion tests -> " decadeConversionTests - testList "Century conversion tests -> " centuryConversionTests - testList "Millennium conversion tests -> " millenniumConversionTests - testList "Eon conversion tests -> " eonConversionTests - ] - -[] -let massTests config = - - let milligramConversionTests = - [ - "From milligram to gram and back", (fun x -> Milligram.create x |> Milligram.toGrams |> Gram.toMilligrams) - "From milligram to kilogram and back", (fun x -> Milligram.create x |> Milligram.toKilograms |> Kilogram.toMilligrams) - "From milligram to pound and back", (fun x -> Milligram.create x |> Milligram.toPoundMass |> PoundMass.toMilligrams) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gramConversionTests = - [ - "From gram to milligram and back", (fun x -> Gram.create x |> Gram.toMilligrams |> Milligram.toGrams) - "From gram to kilogram and back", (fun x -> Gram.create x |> Gram.toKilograms |> Kilogram.toGrams) - "From gram to pound and back", (fun x -> Gram.create x |> Gram.toPoundMass |> PoundMass.toGrams) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilogramConversionTests = - [ - "From kilogram to milligram and back", (fun x -> Kilogram.create x |> Kilogram.toMilligrams |> Milligram.toKilograms) - "From kilogram to gram and back", (fun x -> Kilogram.create x |> Kilogram.toGrams |> Gram.toKilograms) - "From kilogram to pound and back", (fun x -> Kilogram.create x |> Kilogram.toPoundMass |> PoundMass.toKilograms) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let poundConversionTests = - [ - "From pound to milligram and back", (fun x -> PoundMass.create x |> PoundMass.toMilligrams |> Milligram.toPoundMass) - "From pound to gram and back", (fun x -> PoundMass.create x |> PoundMass.toGrams |> Gram.toPoundMass) - "From pound to kilogram and back", (fun x -> PoundMass.create x |> PoundMass.toKilograms |> Kilogram.toPoundMass) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Mass tests -> " [ - testList "Milligram conversion tests -> " milligramConversionTests - testList "Gram conversion tests -> " gramConversionTests - testList "Kilogram conversion tests -> " kilogramConversionTests - testList "Pound conversion tests -> " poundConversionTests - ] - -[] -let temperatureTests config = - - let kelvinConversionTests = - [ - "From kelvin to celsius and back", (fun x -> Kelvin.create x |> Kelvin.toCelsius |> Celsius.toKelvin) - "From kelvin to fahrenheit and back", (fun x -> Kelvin.create x |> Kelvin.toFahrenheit |> Fahrenheit.toKelvin) - "From kelvin to rankine and back", (fun x -> Kelvin.create x |> Kelvin.toRankine |> Rankine.toKelvin) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let celsiusConversionTests = - [ - "From celsius to kelvin and back", (fun x -> Celsius.create x |> Celsius.toKelvin |> Kelvin.toCelsius) - "From celsius to fahrenheit and back", (fun x -> Celsius.create x |> Celsius.toFahrenheit |> Fahrenheit.toCelsius) - "From celsius to rankine and back", (fun x -> Celsius.create x |> Celsius.toRankine |> Rankine.toCelsius) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let fahrenheitConversionTests = - [ - "From fahrenheit to kelvin and back", (fun x -> Fahrenheit.create x |> Fahrenheit.toKelvin |> Kelvin.toFahrenheit) - "From fahrenheit to celsius and back", (fun x -> Fahrenheit.create x |> Fahrenheit.toCelsius |> Celsius.toFahrenheit) - "From fahrenheit to rankine and back", (fun x -> Fahrenheit.create x |> Fahrenheit.toRankine |> Rankine.toFahrenheit) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let rankineConversionTests = - [ - "From rankine to kelvin and back", (fun x -> Rankine.create x |> Rankine.toKelvin |> Kelvin.toRankine) - "From rankine to celsius and back", (fun x -> Rankine.create x |> Rankine.toCelsius |> Celsius.toRankine) - "From rankine to fahrenheit and back", (fun x -> Rankine.create x |> Rankine.toFahrenheit |> Fahrenheit.toRankine) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Temperature Tests -> " [ - testList "Kelvin conversion tests -> " kelvinConversionTests - testList "Celsius conversion tests -> " celsiusConversionTests - testList "Fahrenheit conversion tests -> " fahrenheitConversionTests - testList "Rankine conversion tests -> " rankineConversionTests - ] - -[] -let angleTests config = - - let degreeConversionTests = - [ - "From degrees to radians and back", (fun x -> Degree.create x |> Degree.toRadians |> Radian.toDegrees) - "From degrees to gradians and back", (fun x -> Degree.create x |> Degree.toGradians |> Gradian.toDegrees) - "From degrees to revolutions and back", (fun x -> Degree.create x |> Degree.toRevolutions |> Revolution.toDegrees) - "From degrees to arcminutes and back", (fun x -> Degree.create x |> Degree.toArcMinutes |> ArcMinute.toDegrees) - "From degrees to arcseconds and back", (fun x -> Degree.create x |> Degree.toArcSeconds |> ArcSecond.toDegrees) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let radianConversionTests = - [ - "From radians to degrees and back", (fun x -> Radian.create x |> Radian.toDegrees |> Degree.toRadians) - "From radians to gradians and back", (fun x -> Radian.create x |> Radian.toGradians |> Gradian.toRadians) - "From radians to revolutions and back", (fun x -> Radian.create x |> Radian.toRevolutions |> Revolution.toRadians) - "From radians to arcminutes and back", (fun x -> Radian.create x |> Radian.toArcMinutes |> ArcMinute.toRadians) - "From radians to arcseconds and back", (fun x -> Radian.create x |> Radian.toArcSeconds |> ArcSecond.toRadians) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gradianConversionTests = - [ - "From gradians to degrees and back", (fun x -> Gradian.create x |> Gradian.toDegrees |> Degree.toGradians) - "From gradians to radians and back", (fun x -> Gradian.create x |> Gradian.toRadians |> Radian.toGradians) - "From gradians to revolutions and back", (fun x -> Gradian.create x |> Gradian.toRevolutions |> Revolution.toGradians) - "From gradians to arcminutes and back", (fun x -> Gradian.create x |> Gradian.toArcMinutes |> ArcMinute.toGradians) - "From gradians to arcseconds and back", (fun x -> Gradian.create x |> Gradian.toArcSeconds |> ArcSecond.toGradians) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let revolutionConversionTests = - [ - "From revolutions to degrees and back", (fun x -> Revolution.create x |> Revolution.toDegrees |> Degree.toRevolutions) - "From revolutions to radians and back", (fun x -> Revolution.create x |> Revolution.toRadians |> Radian.toRevolutions) - "From revolutions to gradians and back", (fun x -> Revolution.create x |> Revolution.toGradians |> Gradian.toRevolutions) - "From revolutions to arcminutes and back", (fun x -> Revolution.create x |> Revolution.toArcMinutes |> ArcMinute.toRevolutions) - "From revolutions to arcseconds and back", (fun x -> Revolution.create x |> Revolution.toArcSeconds |> ArcSecond.toRevolutions) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let arcMinuteConversionTests = - [ - "From arcminutes to degrees and back", (fun x -> ArcMinute.create x |> ArcMinute.toDegrees |> Degree.toArcMinutes) - "From arcminutes to radians and back", (fun x -> ArcMinute.create x |> ArcMinute.toRadians |> Radian.toArcMinutes) - "From arcminutes to gradians and back", (fun x -> ArcMinute.create x |> ArcMinute.toGradians |> Gradian.toArcMinutes) - "From arcminutes to revolutions and back", (fun x -> ArcMinute.create x |> ArcMinute.toRevolutions |> Revolution.toArcMinutes) - "From arcminutes to arcseconds and back", (fun x -> ArcMinute.create x |> ArcMinute.toArcSeconds |> ArcSecond.toArcMinutes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let arcSecondConversionTests = - [ - "From arcseconds to degrees and back", (fun x -> ArcSecond.create x |> ArcSecond.toDegrees |> Degree.toArcSeconds) - "From arcseconds to radians and back", (fun x -> ArcSecond.create x |> ArcSecond.toRadians |> Radian.toArcSeconds) - "From arcseconds to gradians and back", (fun x -> ArcSecond.create x |> ArcSecond.toGradians |> Gradian.toArcSeconds) - "From arcseconds to revolutions and back", (fun x -> ArcSecond.create x |> ArcSecond.toRevolutions |> Revolution.toArcSeconds) - "From arcseconds to arcminutes and back", (fun x -> ArcSecond.create x |> ArcSecond.toArcMinutes |> ArcMinute.toArcSeconds) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Angle Tests -> " [ - testList "Degree conversion tests -> " degreeConversionTests - testList "Radian conversion tests -> " radianConversionTests - testList "Gradian conversion tests -> " gradianConversionTests - testList "Revolution conversion tests -> " revolutionConversionTests - testList "ArcMinute conversion tests -> " arcMinuteConversionTests - testList "ArcSecond conversion tests -> " arcSecondConversionTests - ] - -[] -let dataStorageTests config = - - let bitConversionTests = - [ - "From bit to kilobit and back", (fun x -> Bit.create x |> Bit.toKilobits |> Kilobit.toBits) - "From bit to megabit and back", (fun x -> Bit.create x |> Bit.toMegabits |> Megabit.toBits) - "From bit to gigabit and back", (fun x -> Bit.create x |> Bit.toGigabits |> Gigabit.toBits) - "From bit to terabit and back", (fun x -> Bit.create x |> Bit.toTerabits |> Terabit.toBits) - "From bit to petabit and back", (fun x -> Bit.create x |> Bit.toPetabits |> Petabit.toBits) - "From bit to byte and back", (fun x -> Bit.create x |> Bit.toBytes |> Byte.toBits) - "From bit to kilobyte and back", (fun x -> Bit.create x |> Bit.toKilobytes |> Kilobyte.toBits) - "From bit to megabyte and back", (fun x -> Bit.create x |> Bit.toMegabytes |> Megabyte.toBits) - "From bit to gigabyte and back", (fun x -> Bit.create x |> Bit.toGigabytes |> Gigabyte.toBits) - "From bit to terabyte and back", (fun x -> Bit.create x |> Bit.toTerabytes |> Terabyte.toBits) - "From bit to petabyte and back", (fun x -> Bit.create x |> Bit.toPetabytes |> Petabyte.toBits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilobitConversionTests = - [ - "From kilobit to bit and back", (fun x -> Kilobit.create x |> Kilobit.toBits |> Bit.toKilobits) - "From kilobit to megabit and back", (fun x -> Kilobit.create x |> Kilobit.toMegabits |> Megabit.toKilobits) - "From kilobit to gigabit and back", (fun x -> Kilobit.create x |> Kilobit.toGigabits |> Gigabit.toKilobits) - "From kilobit to terabit and back", (fun x -> Kilobit.create x |> Kilobit.toTerabits |> Terabit.toKilobits) - "From kilobit to petabit and back", (fun x -> Kilobit.create x |> Kilobit.toPetabits |> Petabit.toKilobits) - "From kilobit to byte and back", (fun x -> Kilobit.create x |> Kilobit.toBytes |> Byte.toKilobits) - "From kilobit to kilobyte and back", (fun x -> Kilobit.create x |> Kilobit.toKilobytes |> Kilobyte.toKilobits) - "From kilobit to megabyte and back", (fun x -> Kilobit.create x |> Kilobit.toMegabytes |> Megabyte.toKilobits) - "From kilobit to gigabyte and back", (fun x -> Kilobit.create x |> Kilobit.toGigabytes |> Gigabyte.toKilobits) - "From kilobit to terabyte and back", (fun x -> Kilobit.create x |> Kilobit.toTerabytes |> Terabyte.toKilobits) - "From kilobit to petabyte and back", (fun x -> Kilobit.create x |> Kilobit.toPetabytes |> Petabyte.toKilobits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megabitConversionTests = - [ - "From megabit to bit and back", (fun x -> Megabit.create x |> Megabit.toBits |> Bit.toMegabits) - "From megabit to kilobit and back", (fun x -> Megabit.create x |> Megabit.toKilobits |> Kilobit.toMegabits) - "From megabit to gigabit and back", (fun x -> Megabit.create x |> Megabit.toGigabits |> Gigabit.toMegabits) - "From megabit to terabit and back", (fun x -> Megabit.create x |> Megabit.toTerabits |> Terabit.toMegabits) - "From megabit to petabit and back", (fun x -> Megabit.create x |> Megabit.toPetabits |> Petabit.toMegabits) - "From megabit to byte and back", (fun x -> Megabit.create x |> Megabit.toBytes |> Byte.toMegabits) - "From megabit to kilobyte and back", (fun x -> Megabit.create x |> Megabit.toKilobytes |> Kilobyte.toMegabits) - "From megabit to megabyte and back", (fun x -> Megabit.create x |> Megabit.toMegabytes |> Megabyte.toMegabits) - "From megabit to gigabyte and back", (fun x -> Megabit.create x |> Megabit.toGigabytes |> Gigabyte.toMegabits) - "From megabit to terabyte and back", (fun x -> Megabit.create x |> Megabit.toTerabytes |> Terabyte.toMegabits) - "From megabit to petabyte and back", (fun x -> Megabit.create x |> Megabit.toPetabytes |> Petabyte.toMegabits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gigabitConversionTests = - [ - "From gigabit to bit and back", (fun x -> Gigabit.create x |> Gigabit.toBits |> Bit.toGigabits) - "From gigabit to kilobit and back", (fun x -> Gigabit.create x |> Gigabit.toKilobits |> Kilobit.toGigabits) - "From gigabit to megabit and back", (fun x -> Gigabit.create x |> Gigabit.toMegabits |> Megabit.toGigabits) - "From gigabit to terabit and back", (fun x -> Gigabit.create x |> Gigabit.toTerabits |> Terabit.toGigabits) - "From gigabit to petabit and back", (fun x -> Gigabit.create x |> Gigabit.toPetabits |> Petabit.toGigabits) - "From gigabit to byte and back", (fun x -> Gigabit.create x |> Gigabit.toBytes |> Byte.toGigabits) - "From gigabit to kilobyte and back", (fun x -> Gigabit.create x |> Gigabit.toKilobytes |> Kilobyte.toGigabits) - "From gigabit to megabyte and back", (fun x -> Gigabit.create x |> Gigabit.toMegabytes |> Megabyte.toGigabits) - "From gigabit to gigabyte and back", (fun x -> Gigabit.create x |> Gigabit.toGigabytes |> Gigabyte.toGigabits) - "From gigabit to terabyte and back", (fun x -> Gigabit.create x |> Gigabit.toTerabytes |> Terabyte.toGigabits) - "From gigabit to petabyte and back", (fun x -> Gigabit.create x |> Gigabit.toPetabytes |> Petabyte.toGigabits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let terabitConversionTests = - [ - "From terabit to bit and back", (fun x -> Terabit.create x |> Terabit.toBits |> Bit.toTerabits) - "From terabit to kilobit and back", (fun x -> Terabit.create x |> Terabit.toKilobits |> Kilobit.toTerabits) - "From terabit to megabit and back", (fun x -> Terabit.create x |> Terabit.toMegabits |> Megabit.toTerabits) - "From terabit to gigabit and back", (fun x -> Terabit.create x |> Terabit.toGigabits |> Gigabit.toTerabits) - "From terabit to petabit and back", (fun x -> Terabit.create x |> Terabit.toPetabits |> Petabit.toTerabits) - "From terabit to byte and back", (fun x -> Terabit.create x |> Terabit.toBytes |> Byte.toTerabits) - "From terabit to kilobyte and back", (fun x -> Terabit.create x |> Terabit.toKilobytes |> Kilobyte.toTerabits) - "From terabit to megabyte and back", (fun x -> Terabit.create x |> Terabit.toMegabytes |> Megabyte.toTerabits) - "From terabit to gigabyte and back", (fun x -> Terabit.create x |> Terabit.toGigabytes |> Gigabyte.toTerabits) - "From terabit to terabyte and back", (fun x -> Terabit.create x |> Terabit.toTerabytes |> Terabyte.toTerabits) - "From terabit to petabyte and back", (fun x -> Terabit.create x |> Terabit.toPetabytes |> Petabyte.toTerabits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let petabitConversionTests = - [ - "From petabit to bit and back", (fun x -> Petabit.create x |> Petabit.toBits |> Bit.toPetabits) - "From petabit to kilobit and back", (fun x -> Petabit.create x |> Petabit.toKilobits |> Kilobit.toPetabits) - "From petabit to megabit and back", (fun x -> Petabit.create x |> Petabit.toMegabits |> Megabit.toPetabits) - "From petabit to gigabit and back", (fun x -> Petabit.create x |> Petabit.toGigabits |> Gigabit.toPetabits) - "From petabit to terabit and back", (fun x -> Petabit.create x |> Petabit.toTerabits |> Terabit.toPetabits) - "From petabit to byte and back", (fun x -> Petabit.create x |> Petabit.toBytes |> Byte.toPetabits) - "From petabit to kilobyte and back", (fun x -> Petabit.create x |> Petabit.toKilobytes |> Kilobyte.toPetabits) - "From petabit to megabyte and back", (fun x -> Petabit.create x |> Petabit.toMegabytes |> Megabyte.toPetabits) - "From petabit to gigabyte and back", (fun x -> Petabit.create x |> Petabit.toGigabytes |> Gigabyte.toPetabits) - "From petabit to terabyte and back", (fun x -> Petabit.create x |> Petabit.toTerabytes |> Terabyte.toPetabits) - "From petabit to petabyte and back", (fun x -> Petabit.create x |> Petabit.toPetabytes |> Petabyte.toPetabits) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let byteConversionTests = - [ - "From byte to bit and back", (fun x -> Byte.create x |> Byte.toBits |> Bit.toBytes) - "From byte to kilobit and back", (fun x -> Byte.create x |> Byte.toKilobits |> Kilobit.toBytes) - "From byte to megabit and back", (fun x -> Byte.create x |> Byte.toMegabits |> Megabit.toBytes) - "From byte to gigabit and back", (fun x -> Byte.create x |> Byte.toGigabits |> Gigabit.toBytes) - "From byte to terabit and back", (fun x -> Byte.create x |> Byte.toTerabits |> Terabit.toBytes) - "From byte to petabit and back", (fun x -> Byte.create x |> Byte.toPetabits |> Petabit.toBytes) - "From byte to kilobyte and back", (fun x -> Byte.create x |> Byte.toKilobytes |> Kilobyte.toBytes) - "From byte to megabyte and back", (fun x -> Byte.create x |> Byte.toMegabytes |> Megabyte.toBytes) - "From byte to gigabyte and back", (fun x -> Byte.create x |> Byte.toGigabytes |> Gigabyte.toBytes) - "From byte to terabyte and back", (fun x -> Byte.create x |> Byte.toTerabytes |> Terabyte.toBytes) - "From byte to petabyte and back", (fun x -> Byte.create x |> Byte.toPetabytes |> Petabyte.toBytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilobyteConversionTests = - [ - "From kilobyte to bit and back", (fun x -> Kilobyte.create x |> Kilobyte.toBits |> Bit.toKilobytes) - "From kilobyte to kilobit and back", (fun x -> Kilobyte.create x |> Kilobyte.toKilobits |> Kilobit.toKilobytes) - "From kilobyte to megabit and back", (fun x -> Kilobyte.create x |> Kilobyte.toMegabits |> Megabit.toKilobytes) - "From kilobyte to gigabit and back", (fun x -> Kilobyte.create x |> Kilobyte.toGigabits |> Gigabit.toKilobytes) - "From kilobyte to terabit and back", (fun x -> Kilobyte.create x |> Kilobyte.toTerabits |> Terabit.toKilobytes) - "From kilobyte to petabit and back", (fun x -> Kilobyte.create x |> Kilobyte.toPetabits |> Petabit.toKilobytes) - "From kilobyte to byte and back", (fun x -> Kilobyte.create x |> Kilobyte.toBytes |> Byte.toKilobytes) - "From kilobyte to megabyte and back", (fun x -> Kilobyte.create x |> Kilobyte.toMegabytes |> Megabyte.toKilobytes) - "From kilobyte to gigabyte and back", (fun x -> Kilobyte.create x |> Kilobyte.toGigabytes |> Gigabyte.toKilobytes) - "From kilobyte to terabyte and back", (fun x -> Kilobyte.create x |> Kilobyte.toTerabytes |> Terabyte.toKilobytes) - "From kilobyte to petabyte and back", (fun x -> Kilobyte.create x |> Kilobyte.toPetabytes |> Petabyte.toKilobytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megabyteConversionTests = - [ - "From megabyte to bit and back", (fun x -> Megabyte.create x |> Megabyte.toBits |> Bit.toMegabytes) - "From megabyte to kilobit and back", (fun x -> Megabyte.create x |> Megabyte.toKilobits |> Kilobit.toMegabytes) - "From megabyte to megabit and back", (fun x -> Megabyte.create x |> Megabyte.toMegabits |> Megabit.toMegabytes) - "From megabyte to gigabit and back", (fun x -> Megabyte.create x |> Megabyte.toGigabits |> Gigabit.toMegabytes) - "From megabyte to terabit and back", (fun x -> Megabyte.create x |> Megabyte.toTerabits |> Terabit.toMegabytes) - "From megabyte to petabit and back", (fun x -> Megabyte.create x |> Megabyte.toPetabits |> Petabit.toMegabytes) - "From megabyte to byte and back", (fun x -> Megabyte.create x |> Megabyte.toBytes |> Byte.toMegabytes) - "From megabyte to kilobyte and back", (fun x -> Megabyte.create x |> Megabyte.toKilobytes |> Kilobyte.toMegabytes) - "From megabyte to gigabyte and back", (fun x -> Megabyte.create x |> Megabyte.toGigabytes |> Gigabyte.toMegabytes) - "From megabyte to terabyte and back", (fun x -> Megabyte.create x |> Megabyte.toTerabytes |> Terabyte.toMegabytes) - "From megabyte to petabyte and back", (fun x -> Megabyte.create x |> Megabyte.toPetabytes |> Petabyte.toMegabytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gigabyteConversionTests = - [ - "From gigabyte to bit and back", (fun x -> Gigabyte.create x |> Gigabyte.toBits |> Bit.toGigabytes) - "From gigabyte to kilobit and back", (fun x -> Gigabyte.create x |> Gigabyte.toKilobits |> Kilobit.toGigabytes) - "From gigabyte to megabit and back", (fun x -> Gigabyte.create x |> Gigabyte.toMegabits |> Megabit.toGigabytes) - "From gigabyte to gigabit and back", (fun x -> Gigabyte.create x |> Gigabyte.toGigabits |> Gigabit.toGigabytes) - "From gigabyte to terabit and back", (fun x -> Gigabyte.create x |> Gigabyte.toTerabits |> Terabit.toGigabytes) - "From gigabyte to petabit and back", (fun x -> Gigabyte.create x |> Gigabyte.toPetabits |> Petabit.toGigabytes) - "From gigabyte to byte and back", (fun x -> Gigabyte.create x |> Gigabyte.toBytes |> Byte.toGigabytes) - "From gigabyte to kilobyte and back", (fun x -> Gigabyte.create x |> Gigabyte.toKilobytes |> Kilobyte.toGigabytes) - "From gigabyte to megabyte and back", (fun x -> Gigabyte.create x |> Gigabyte.toMegabytes |> Megabyte.toGigabytes) - "From gigabyte to terabyte and back", (fun x -> Gigabyte.create x |> Gigabyte.toTerabytes |> Terabyte.toGigabytes) - "From gigabyte to petabyte and back", (fun x -> Gigabyte.create x |> Gigabyte.toPetabytes |> Petabyte.toGigabytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let terabyteConversionTests = - [ - "From terabyte to bit and back", (fun x -> Terabyte.create x |> Terabyte.toBits |> Bit.toTerabytes) - "From terabyte to kilobit and back", (fun x -> Terabyte.create x |> Terabyte.toKilobits |> Kilobit.toTerabytes) - "From terabyte to megabit and back", (fun x -> Terabyte.create x |> Terabyte.toMegabits |> Megabit.toTerabytes) - "From terabyte to gigabit and back", (fun x -> Terabyte.create x |> Terabyte.toGigabits |> Gigabit.toTerabytes) - "From terabyte to terabit and back", (fun x -> Terabyte.create x |> Terabyte.toTerabits |> Terabit.toTerabytes) - "From terabyte to petabit and back", (fun x -> Terabyte.create x |> Terabyte.toPetabits |> Petabit.toTerabytes) - "From terabyte to byte and back", (fun x -> Terabyte.create x |> Terabyte.toBytes |> Byte.toTerabytes) - "From terabyte to kilobyte and back", (fun x -> Terabyte.create x |> Terabyte.toKilobytes |> Kilobyte.toTerabytes) - "From terabyte to megabyte and back", (fun x -> Terabyte.create x |> Terabyte.toMegabytes |> Megabyte.toTerabytes) - "From terabyte to gigabyte and back", (fun x -> Terabyte.create x |> Terabyte.toGigabytes |> Gigabyte.toTerabytes) - "From terabyte to petabyte and back", (fun x -> Terabyte.create x |> Terabyte.toPetabytes |> Petabyte.toTerabytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let petabyteConversionTests = - [ - "From petabyte to bit and back", (fun x -> Petabyte.create x |> Petabyte.toBits |> Bit.toPetabytes) - "From petabyte to kilobit and back", (fun x -> Petabyte.create x |> Petabyte.toKilobits |> Kilobit.toPetabytes) - "From petabyte to megabit and back", (fun x -> Petabyte.create x |> Petabyte.toMegabits |> Megabit.toPetabytes) - "From petabyte to gigabit and back", (fun x -> Petabyte.create x |> Petabyte.toGigabits |> Gigabit.toPetabytes) - "From petabyte to terabit and back", (fun x -> Petabyte.create x |> Petabyte.toTerabits |> Terabit.toPetabytes) - "From petabyte to petabit and back", (fun x -> Petabyte.create x |> Petabyte.toPetabits |> Petabit.toPetabytes) - "From petabyte to byte and back", (fun x -> Petabyte.create x |> Petabyte.toBytes |> Byte.toPetabytes) - "From petabyte to kilobyte and back", (fun x -> Petabyte.create x |> Petabyte.toKilobytes |> Kilobyte.toPetabytes) - "From petabyte to megabyte and back", (fun x -> Petabyte.create x |> Petabyte.toMegabytes |> Megabyte.toPetabytes) - "From petabyte to gigabyte and back", (fun x -> Petabyte.create x |> Petabyte.toGigabytes |> Gigabyte.toPetabytes) - "From petabyte to terabyte and back", (fun x -> Petabyte.create x |> Petabyte.toTerabytes |> Terabyte.toPetabytes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Data storage tests -> " [ - testList "Bit conversion tests -> " bitConversionTests - testList "Kilobit conversion tests -> " kilobitConversionTests - testList "Megabit conversion tests -> " megabitConversionTests - testList "Gigabit conversion tests -> " gigabitConversionTests - testList "Terabit conversion tests -> " terabitConversionTests - testList "Petabit conversion tests -> " petabitConversionTests - testList "Byte conversion tests -> " byteConversionTests - testList "Kilobyte conversion tests -> " kilobyteConversionTests - testList "Megabyte conversion tests -> " megabyteConversionTests - testList "Gigabyte conversion tests -> " gigabyteConversionTests - testList "Terabyte conversion tests -> " terabyteConversionTests - testList "Petabyte conversion tests -> " petabyteConversionTests - ] - -[] -let fuelEconomyTests config = - - let kilometerPerLiterConversionTests = - [ - "From km/l to mpg", (fun x -> KilometerPerLiter.create x |> KilometerPerLiter.toMilesPerGallon |> MilePerGallon.toKilometersPerLiter) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let milePerGallonConversionTests = - [ - "From mpg to km/l", (fun x -> MilePerGallon.create x |> MilePerGallon.toKilometersPerLiter |> KilometerPerLiter.toMilesPerGallon) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Fuel economy tests -> " [ - testList "Kilometer per liter tests -> " kilometerPerLiterConversionTests - testList "Mile per gallon tests -> " milePerGallonConversionTests - ] - -[] -let frequencyTests config = - - let hertzConversionTest = - [ - "From hertz to kilohertz and back", (fun x -> Hertz.create x |> Hertz.toKilohertz |> Kilohertz.toHertz) - "From hertz to megahertz and back", (fun x -> Hertz.create x |> Hertz.toMegahertz |> Megahertz.toHertz) - "From hertz to gigahertz and back", (fun x -> Hertz.create x |> Hertz.toGigahertz |> Gigahertz.toHertz) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let kilohertzConversionTest = - [ - "From kilohertz to hertz and back", (fun x -> Kilohertz.create x |> Kilohertz.toHertz |> Hertz.toKilohertz) - "From kilohertz to megahertz and back", (fun x -> Kilohertz.create x |> Kilohertz.toMegahertz |> Megahertz.toKilohertz) - "From kilohertz to gigahertz and back", (fun x -> Kilohertz.create x |> Kilohertz.toGigahertz |> Gigahertz.toKilohertz) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let megahertzConversionTest = - [ - "From megahertz to hertz and back", (fun x -> Megahertz.create x |> Megahertz.toHertz |> Hertz.toMegahertz) - "From megahertz to kilohertz and back", (fun x -> Megahertz.create x |> Megahertz.toKilohertz |> Kilohertz.toMegahertz) - "From megahertz to gigahertz and back", (fun x -> Megahertz.create x |> Megahertz.toGigahertz |> Gigahertz.toMegahertz) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let gigahertzConversionTest = - [ - "From gigahertz to hertz and back", (fun x -> Gigahertz.create x |> Gigahertz.toHertz |> Hertz.toGigahertz) - "From gigahertz to kilohertz and back", (fun x -> Gigahertz.create x |> Gigahertz.toKilohertz |> Kilohertz.toGigahertz) - "From gigahertz to megahertz and back", (fun x -> Gigahertz.create x |> Gigahertz.toMegahertz |> Megahertz.toGigahertz) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Frequency tests -> " [ - testList "Hertz conversion tests -> " hertzConversionTest - testList "Kilohertz conversion tests -> " kilohertzConversionTest - testList "Megahertz conversion tests -> " megahertzConversionTest - testList "Gigahertz conversion tests -> " gigahertzConversionTest - ] - -[] -let illuminanceTests config = - - let footcandleConversionTests = - [ - "From footcandle to lux and back", (fun x -> Footcandle.create x |> Footcandle.toLux |> Lux.toFootcandle) - "From footcandle to phot and back", (fun x -> Footcandle.create x |> Footcandle.toPhot |> Phot.toFootcandle) - "From footcandle to nox and back", (fun x -> Footcandle.create x |> Footcandle.toNox |> Nox.toFootcandle) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let luxConversionTests = - [ - "From lux to footcandle and back", (fun x -> Lux.create x |> Lux.toFootcandle |> Footcandle.toLux) - "From lux to phot and back", (fun x -> Lux.create x |> Lux.toPhot |> Phot.toLux) - "From lux to nox and back", (fun x -> Lux.create x |> Lux.toNox |> Nox.toLux) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let photConversionTests = - [ - "From phot to footcandle and back", (fun x -> Phot.create x |> Phot.toFootcandle |> Footcandle.toPhot) - "From phot to lux and back", (fun x -> Phot.create x |> Phot.toLux |> Lux.toPhot) - "From phot to nox and back", (fun x -> Phot.create x |> Phot.toNox |> Nox.toPhot) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let noxConversionTests = - [ - "From nox to footcandle and back", (fun x -> Nox.create x |> Nox.toFootcandle |> Footcandle.toNox) - "From nox to lux and back", (fun x -> Nox.create x |> Nox.toLux |> Lux.toNox) - "From nox to phot and back", (fun x -> Nox.create x |> Nox.toPhot |> Phot.toNox) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Illuminance tests -> " [ - testList "Footcandle conversion tests -> " footcandleConversionTests - testList "Lux conversion tests -> " luxConversionTests - testList "Phot conversion tests -> " photConversionTests - testList "Nox conversion tests -> " noxConversionTests - ] - -[] -let currentTests config = - - let ampereConversionTests = - [ - "From ampere to milliampere and back", (fun x -> Ampere.create x |> Ampere.toMilliamperes |> Milliampere.toAmperes) - "From ampere to microampere and back", (fun x -> Ampere.create x |> Ampere.toMicroamperes |> Microampere.toAmperes) - "From ampere to biot and back", (fun x -> Ampere.create x |> Ampere.toBiots |> Biot.toAmperes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let milliampereConversionTests = - [ - "From milliampere to ampere and back", (fun x -> Milliampere.create x |> Milliampere.toAmperes |> Ampere.toMilliamperes) - "From milliampere to microampere and back", (fun x -> Milliampere.create x |> Milliampere.toMicroamperes |> Microampere.toMilliamperes) - "From milliampere to biot and back", (fun x -> Milliampere.create x |> Milliampere.toBiots |> Biot.toMilliamperes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let microampereConversionTests = - [ - "From microampere to ampere and back", (fun x -> Microampere.create x |> Microampere.toAmperes |> Ampere.toMicroamperes) - "From microampere to milliampere and back", (fun x -> Microampere.create x |> Microampere.toMilliamperes |> Milliampere.toMicroamperes) - "From microampere to biot and back", (fun x -> Microampere.create x |> Microampere.toBiots |> Biot.toMicroamperes) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - let biotConversionTests = - [ - "From biot to ampere and back", (fun x -> Biot.create x |> Biot.toAmperes |> Ampere.toBiots) - "From biot to milliampere and back", (fun x -> Biot.create x |> Biot.toMilliamperes |> Milliampere.toBiots) - "From biot to microampere and back", (fun x -> Biot.create x |> Biot.toMicroamperes |> Microampere.toBiots) - ] - |> List.map (fun (x,y) -> testConversionRoundingError config Accuracy.high x y) - - testList "Current tests -> " [ - testList "Ampere conversion tests -> " ampereConversionTests - testList "Milliampere conversion tests -> " milliampereConversionTests - testList "Microampere conversion tests -> " microampereConversionTests - testList "Biot conversion tests -> " biotConversionTests - ] diff --git a/Fs.Units.Tests.Unit/paket.references b/Fs.Units.Tests.Unit/paket.references deleted file mode 100644 index e95d5ee..0000000 --- a/Fs.Units.Tests.Unit/paket.references +++ /dev/null @@ -1,6 +0,0 @@ -Expecto -Expecto.FsCheck -FsCheck -YoloDev.Expecto.TestSdk -Microsoft.NET.Test.Sdk -FSharp.Core \ No newline at end of file diff --git a/Fs.Units.sln b/Fs.Units.sln index be7dd6d..6518822 100644 --- a/Fs.Units.sln +++ b/Fs.Units.sln @@ -3,17 +3,38 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{1995D6F3-A6E2-4A80-AC74-65ED82E7D935}" ProjectSection(SolutionItems) = preProject paket.dependencies = paket.dependencies + paket.lock = paket.lock EndProjectSection EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units", "Fs.Units\Fs.Units.fsproj", "{0BEF09E5-F0DB-4E5C-A2A7-5A0B4ABCD8E6}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{F1E793FB-AD0A-4021-AA39-325C6ADCD027}" + ProjectSection(SolutionItems) = preProject + .config\dotnet-tools.json = .config\dotnet-tools.json + .editorconfig = .editorconfig + global.json = global.json + .fantomasignore = .fantomasignore + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{176FA884-3899-42F0-BDFD-B3875FC54579}" + ProjectSection(SolutionItems) = preProject + RELEASE_NOTES.md = RELEASE_NOTES.md + README.md = README.md + EndProjectSection EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units.Tests.Unit", "Fs.Units.Tests.Unit\Fs.Units.Tests.Unit.fsproj", "{E39D2DE0-2DF8-466C-A8E3-9334585E2FA0}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{179F015A-544E-4E2D-9A3E-13E5B2D0E332}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units.Tests.Benchmark", "Fs.Units.Tests.Benchmark\Fs.Units.Tests.Benchmark.fsproj", "{32FF53B5-CFF9-447A-9ACE-BACB878C22B0}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{4830CA8B-7A33-4ED2-AC09-3165C26BD552}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fs.Units.CSharp", "Fs.Units.CSharp\Fs.Units.CSharp.csproj", "{BEDDB7E3-5CF7-4CFA-9372-4609035EEB9F}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units", "src\Fs.Units\Fs.Units.fsproj", "{C5F26AD4-464D-4664-8BD0-D4AE84B22D50}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fs.Units.CSharp.Tests.Benchmark", "Fs.Units.CSharp.Tests.Benchmark\Fs.Units.CSharp.Tests.Benchmark.csproj", "{39B6654C-ADA0-4B17-86F6-5C5C3CACFB06}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fs.Units.CSharp", "src\Fs.Units.CSharp\Fs.Units.CSharp.csproj", "{C46654E1-5365-4A6B-98E1-C82C38719193}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units.Tests.Unit", "tests\Fs.Units.Tests.Unit\Fs.Units.Tests.Unit.fsproj", "{F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fs.Units.Tests.Benchmark", "benchmarks\Fs.Units.Tests.Benchmark\Fs.Units.Tests.Benchmark.fsproj", "{91929E4F-920D-48B9-84BE-994DD9685017}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fs.Units.CSharp.Tests.Benchmark", "benchmarks\Fs.Units.CSharp.Tests.Benchmark\Fs.Units.CSharp.Tests.Benchmark.csproj", "{70E86CB4-BB1B-430C-8D5E-B66D94C97CFA}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build\build.fsproj", "{C58EC2C4-D8D1-424A-BB59-73AC2AB8418F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,25 +42,36 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0BEF09E5-F0DB-4E5C-A2A7-5A0B4ABCD8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0BEF09E5-F0DB-4E5C-A2A7-5A0B4ABCD8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0BEF09E5-F0DB-4E5C-A2A7-5A0B4ABCD8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0BEF09E5-F0DB-4E5C-A2A7-5A0B4ABCD8E6}.Release|Any CPU.Build.0 = Release|Any CPU - {E39D2DE0-2DF8-466C-A8E3-9334585E2FA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E39D2DE0-2DF8-466C-A8E3-9334585E2FA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E39D2DE0-2DF8-466C-A8E3-9334585E2FA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E39D2DE0-2DF8-466C-A8E3-9334585E2FA0}.Release|Any CPU.Build.0 = Release|Any CPU - {32FF53B5-CFF9-447A-9ACE-BACB878C22B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32FF53B5-CFF9-447A-9ACE-BACB878C22B0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32FF53B5-CFF9-447A-9ACE-BACB878C22B0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32FF53B5-CFF9-447A-9ACE-BACB878C22B0}.Release|Any CPU.Build.0 = Release|Any CPU - {BEDDB7E3-5CF7-4CFA-9372-4609035EEB9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BEDDB7E3-5CF7-4CFA-9372-4609035EEB9F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BEDDB7E3-5CF7-4CFA-9372-4609035EEB9F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BEDDB7E3-5CF7-4CFA-9372-4609035EEB9F}.Release|Any CPU.Build.0 = Release|Any CPU - {39B6654C-ADA0-4B17-86F6-5C5C3CACFB06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39B6654C-ADA0-4B17-86F6-5C5C3CACFB06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39B6654C-ADA0-4B17-86F6-5C5C3CACFB06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39B6654C-ADA0-4B17-86F6-5C5C3CACFB06}.Release|Any CPU.Build.0 = Release|Any CPU + {C5F26AD4-464D-4664-8BD0-D4AE84B22D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5F26AD4-464D-4664-8BD0-D4AE84B22D50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5F26AD4-464D-4664-8BD0-D4AE84B22D50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5F26AD4-464D-4664-8BD0-D4AE84B22D50}.Release|Any CPU.Build.0 = Release|Any CPU + {C46654E1-5365-4A6B-98E1-C82C38719193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C46654E1-5365-4A6B-98E1-C82C38719193}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C46654E1-5365-4A6B-98E1-C82C38719193}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C46654E1-5365-4A6B-98E1-C82C38719193}.Release|Any CPU.Build.0 = Release|Any CPU + {F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5}.Release|Any CPU.Build.0 = Release|Any CPU + {91929E4F-920D-48B9-84BE-994DD9685017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91929E4F-920D-48B9-84BE-994DD9685017}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91929E4F-920D-48B9-84BE-994DD9685017}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91929E4F-920D-48B9-84BE-994DD9685017}.Release|Any CPU.Build.0 = Release|Any CPU + {70E86CB4-BB1B-430C-8D5E-B66D94C97CFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70E86CB4-BB1B-430C-8D5E-B66D94C97CFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70E86CB4-BB1B-430C-8D5E-B66D94C97CFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70E86CB4-BB1B-430C-8D5E-B66D94C97CFA}.Release|Any CPU.Build.0 = Release|Any CPU + {C58EC2C4-D8D1-424A-BB59-73AC2AB8418F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C58EC2C4-D8D1-424A-BB59-73AC2AB8418F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C58EC2C4-D8D1-424A-BB59-73AC2AB8418F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C58EC2C4-D8D1-424A-BB59-73AC2AB8418F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {C5F26AD4-464D-4664-8BD0-D4AE84B22D50} = {176FA884-3899-42F0-BDFD-B3875FC54579} + {C46654E1-5365-4A6B-98E1-C82C38719193} = {176FA884-3899-42F0-BDFD-B3875FC54579} + {F0FA4235-A49E-4AE3-A1F8-78977B4FE8C5} = {179F015A-544E-4E2D-9A3E-13E5B2D0E332} + {91929E4F-920D-48B9-84BE-994DD9685017} = {4830CA8B-7A33-4ED2-AC09-3165C26BD552} + {70E86CB4-BB1B-430C-8D5E-B66D94C97CFA} = {4830CA8B-7A33-4ED2-AC09-3165C26BD552} EndGlobalSection EndGlobal diff --git a/Fs.Units/Compound/Area.fs b/Fs.Units/Compound/Area.fs deleted file mode 100644 index 4fe122c..0000000 --- a/Fs.Units/Compound/Area.fs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Fs.Units.Area - -open Fs.Units.Length.Units - -module Units = - - /// Square inch - [] type in2 = inch * inch - - /// Square foot - [] type ft2 = ft * ft - - /// Square centimeter - [] type cm2 = cm * cm - - /// Square meter - [] type m2 = m * m - -open Units -open Fs.Units.Length - -module SquareInch = - - let create (x:float) = x * 1.0 - let toSquareFeet (x: float) = - let length = Inch.create 1 |> Inch.toFeet - x * length * length / 1.0 - let toSquareCentimeters (x: float) = - let length = Inch.create 1 |> Inch.toCentimeters - x * length * length / 1.0 - let toSquareMeters (x: float) = - let length = Inch.create 1 |> Inch.toMeters - x * length * length / 1.0 - -module SquareFoot = - - let create (x:float) = x * 1.0 - let toSquareInches (x: float) = - let length = Foot.create 1 |> Foot.toInches - x * (length * length) / 1.0 - let toSquareCentimeters (x: float) = - let length = Foot.create 1 |> Foot.toCentimeters - x * length * length / 1.0 - let toSquareMeters (x: float) = - let length = Foot.create 1 |> Foot.toMeters - x * length * length / 1.0 - -module SquareCentimeter = - - let create (x:float) = x * 1.0 - let toSquareInches (x: float) = - let length = Centimeter.create 1 |> Centimeter.toInches - x * length * length / 1.0 - let toSquareFeet (x: float) = - let length = Centimeter.create 1 |> Centimeter.toFeet - x * length * length / 1.0 - let toSquareMeters (x: float) = - let length = Centimeter.create 1 |> Centimeter.toMeters - x * length * length / 1.0 - -module SquareMeter = - - let create (x:float) = x * 1.0 - let toSquareInches (x: float) = - let length = Meter.create 1 |> Meter.toInches - x * length * length / 1.0 - let toSquareFeet (x: float) = - let length = Meter.create 1 |> Meter.toFeet - x * length * length / 1.0 - let toSquareCentimeters (x: float) = - let length = Meter.create 1 |> Meter.toCentimeters - x * length * length / 1.0 - \ No newline at end of file diff --git a/Fs.Units/Compound/Capacitance.fs b/Fs.Units/Compound/Capacitance.fs deleted file mode 100644 index dd0d7ea..0000000 --- a/Fs.Units/Compound/Capacitance.fs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Fs.Units.Capacitance - -open Fs.Units - -module Units = - - /// Farad - [] type F = Time.Units.s * Time.Units.s * Time.Units.s * Time.Units.s * Current.Units.A * Current.Units.A / Length.Units.m / Length.Units.m / Mass.Units.kg - -open Units - -module Farad = - - let create (x: float) = x * 1.0 diff --git a/Fs.Units/Compound/Density.fs b/Fs.Units/Compound/Density.fs deleted file mode 100644 index d574b9b..0000000 --- a/Fs.Units/Compound/Density.fs +++ /dev/null @@ -1,85 +0,0 @@ -namespace Fs.Units.Density - -open Fs.Units - -module Units = - - /// Kilogram per cubic meter - [] type kgm3 = Mass.Units.kg / Volume.Units.m3 - - /// Gram per cubic centimeter - [] type gcm3 = Mass.Units.g / Volume.Units.cm3 - - /// Pound mass per cubic foot - [] type lbmft3 = Mass.Units.lbm / Volume.Units.ft3 - - /// Pound mass per cubic inch - [] type lbmin3 = Mass.Units.lbm / Volume.Units.in3 - -open Units -open Fs.Units.Volume -open Fs.Units.Mass - -module KilogramPerCubicMeter = - - let create (x: float) = x * 1.0 - let toGramsPerCubicCentimeter (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toGrams - let volume = CubicMeter.create 1 |> CubicMeter.toCubicCentimeters - x * mass / volume / 1.0 - let toPoundMassPerCubicFoot (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toPoundMass - let volume = CubicMeter.create 1 |> CubicMeter.toCubicFeet - x * mass / volume / 1.0 - let toPoundMassPerCubicInch (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toPoundMass - let volume = CubicMeter.create 1 |> CubicMeter.toCubicInches - x * mass / volume / 1.0 - -module GramPerCubicCentimeter = - - let create (x: float) = x * 1.0 - let toKilogramsPerCubicMeter (x: float) = - let mass = Gram.create 1 |> Gram.toKilograms - let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicMeters - x * mass / volume / 1.0 - let toPoundMassPerCubicFoot (x: float) = - let mass = Gram.create 1 |> Gram.toPoundMass - let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicFeet - x * mass / volume / 1.0 - let toPoundMassPerCubicInch (x: float) = - let mass = Gram.create 1 |> Gram.toPoundMass - let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicInches - x * mass / volume / 1.0 - -module PoundMassPerCubicFoot = - - let create (x: float) = x * 1.0 - let toKilogramsPerCubicMeter (x: float) = - let mass = PoundMass.create 1 |> PoundMass.toKilograms - let volume = CubicFoot.create 1 |> CubicFoot.toCubicMeters - x * mass / volume / 1.0 - let toGramsPerCubicCentimeter (x: float) = - let mass = PoundMass.create 1 |> PoundMass.toGrams - let volume = CubicFoot.create 1 |> CubicFoot.toCubicCentimeters - x * mass / volume / 1.0 - let toPoundMassPerCubicInch (x: float) = - let mass = PoundMass.create 1 - let volume = CubicFoot.create 1 |> CubicFoot.toCubicInches - x * mass / volume / 1.0 - -module PoundMassPerCubicInch = - - let create (x: float) = x * 1.0 - let toKilogramsPerCubicMeter (x: float) = - let mass = PoundMass.create 1 |> PoundMass.toKilograms - let volume = CubicInch.create 1 |> CubicInch.toCubicMeters - x * mass / volume / 1.0 - let toGramsPerCubicCentimeter (x: float) = - let mass = PoundMass.create 1 |> PoundMass.toGrams - let volume = CubicInch.create 1 |> CubicInch.toCubicCentimeters - x * mass / volume / 1.0 - let toPoundMassPerCubicFoot (x: float) = - let mass = PoundMass.create 1 - let volume = CubicInch.create 1 |> CubicInch.toCubicFeet - x * mass / volume / 1.0 \ No newline at end of file diff --git a/Fs.Units/Compound/ElectricCharge.fs b/Fs.Units/Compound/ElectricCharge.fs deleted file mode 100644 index 1929787..0000000 --- a/Fs.Units/Compound/ElectricCharge.fs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Fs.Units.ElectricCharge - -open Fs.Units - -module Units = - - /// Coloumb - [] type C = Current.Units.A * Time.Units.s - - /// Ampere-hour - [] type Ah = Current.Units.A * Time.Units.hr - - /// Ampere-second - [] type As = Current.Units.A * Time.Units.s - -open Units -open Fs.Units.Current -open Fs.Units.Time - -module Coloumb = - - let create (x: float) = x * 1.0 - let toAmpereHours (x: float) = - let current = Ampere.create 1 - let time = Second.create 1 |> Second.toHours - x * current * time / 1.0 - let toAmpereSeconds (x: float) = x * 1.0 / 1.0 - -module AmpereHour = - let create (x: float) = x * 1.0 - let toColoumbs (x: float) = - let current = Ampere.create 1 - let time = Hour.create 1 |> Hour.toSeconds - x * current * time / 1.0 - let toAmpereSeconds (x: float) = - let current = Ampere.create 1 - let time = Hour.create 1 |> Hour.toSeconds - x * current * time / 1.0 - -module AmpereSecond = - - let create (x: float) = x * 1.0 - let toColoumbs (x: float) = x * 1.0 / 1.0 - let toAmpereHours (x: float) = - let current = Ampere.create 1 - let time = Second.create 1 |> Second.toHours - x * current * time / 1.0 \ No newline at end of file diff --git a/Fs.Units/Compound/Force.fs b/Fs.Units/Compound/Force.fs deleted file mode 100644 index 6d0324d..0000000 --- a/Fs.Units/Compound/Force.fs +++ /dev/null @@ -1,74 +0,0 @@ -namespace Fs.Units.Force - -open Fs.Units - -module Units = - - /// Newton - [] type N = Mass.Units.kg * Length.Units.m / (Time.Units.s * Time.Units.s) - - /// Pound force - [] type lbf = Mass.Units.lbm * Length.Units.ft / (Time.Units.s * Time.Units.s) - - /// Dyne - [] type dyn = Mass.Units.g * Length.Units.cm / (Time.Units.s * Time.Units.s) - - /// Kip - [] type kip - -open Units -open Fs.Units.Mass -open Fs.Units.Length -open Fs.Units.Time - -module Newton = - - let create (x: float) = x * 1.0 - let toPoundForce (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toPoundMass - let length = Meter.create 1 |> Meter.toFeet - let time = Second.create 1 - x * mass * length / time / time / 1.0 - let toDynes (x: float) = - let mass = Kilogram.create 1 |> Kilogram.toGrams - let length = Meter.create 1 |> Meter.toCentimeters - let time = Second.create 1 - x * mass * length / time / time / 1.0 - let toKips (x: float) = x * 2.24809e-4 / 1.0 - -module PoundForce = - - let create (x: float) = x * 1.0 - let toNewtons (x: float) = - let a = PoundMass.create 1 |> PoundMass.toKilograms - let b = Foot.create 1 |> Foot.toMeters - let time = Second.create 1 - x * a * b / time / time / 1.0 - let toDynes (x: float) = - let mass = PoundMass.create 1 |> PoundMass.toGrams - let length = Foot.create 1 |> Foot.toCentimeters - let time = Second.create 1 - x * mass * length / time / time / 1.0 - let toKips (x: float) = x * 0.001 / 1.0 - -module Dyne = - - let create (x: float) = x * 1.0 - let toNewtons (x: float) = - let mass = Gram.create 1 |> Gram.toKilograms - let length = Centimeter.create 1 |> Centimeter.toMeters - let time = Second.create 1 - x * mass * length / time / time / 1.0 - let toPoundForce (x: float) = - let mass = Gram.create 1 |> Gram.toPoundMass - let length = Centimeter.create 1 |> Centimeter.toFeet - let time = Second.create 1 - x * mass * length / time / time / 1.0 - let toKips (x: float) = x * 2.24809e-9 / 1.0 - -module Kip = - - let create (x: float) = x * 1.0 - let toNewtons (x: float) = x * 1.0 / 2.24809e-4 - let toPoundForce (x: float) = x * 1.0 / 0.001 - let toDynes (x: float) = x * 1.0 / 2.24809e-9 \ No newline at end of file diff --git a/Fs.Units/Compound/Inertia.fs b/Fs.Units/Compound/Inertia.fs deleted file mode 100644 index 659b857..0000000 --- a/Fs.Units/Compound/Inertia.fs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Fs.Units.Inertia - -open Fs.Units - -module Units = - - [] type in4 = Length.Units.inch * Length.Units.inch * Length.Units.inch * Length.Units.inch - - [] - type cm4 = Length.Units.cm * Length.Units.cm * Length.Units.cm * Length.Units.cm - -open Units -open Fs.Units.Length - -module QuarticInch = - - let create (x:float) = x * 1.0 - let toQuarticCentimeters (x: float) = - let length = Inch.create 1 |> Inch.toCentimeters - x * length * length * length * length / 1.0 - -module QuarticCentimeter = - - let create (x:float) = x * 1.0 - let toQuarticInches (x: float) = - let length = Centimeter.create 1 |> Centimeter.toInches - x * length * length * length * length / 1.0 \ No newline at end of file diff --git a/Fs.Units/Compound/Pressure.fs b/Fs.Units/Compound/Pressure.fs deleted file mode 100644 index 834b8d1..0000000 --- a/Fs.Units/Compound/Pressure.fs +++ /dev/null @@ -1,31 +0,0 @@ -namespace Fs.Units.Pressure - -open Fs.Units - -module Units = - - /// Pascal - [] type Pa = Force.Units.N / Length.Units.m / Length.Units.m - - /// Pounds per square inch - [] type psi = Force.Units.lbf / Length.Units.inch / Length.Units.inch - -open Units -open Fs.Units.Force -open Fs.Units.Length - -module Pascal = - - let create (x: float) = x * 1.0 - let toPoundsPerSquareInch (x: float) = - let force = Newton.create 1 |> Newton.toPoundForce - let length = Meter.create 1 |> Meter.toInches - x * force / length / length / 1.0 - -module PoundPerSquareInch = - - let create (x: float) = x * 1.0 - let toPascals (x: float) = - let force = PoundForce.create 1 |> PoundForce.toNewtons - let length = Inch.create 1 |> Inch.toMeters - x * force / length / length / 1.0 \ No newline at end of file diff --git a/Fs.Units/Compound/Speed.fs b/Fs.Units/Compound/Speed.fs deleted file mode 100644 index ab2155b..0000000 --- a/Fs.Units/Compound/Speed.fs +++ /dev/null @@ -1,85 +0,0 @@ -namespace Fs.Units.Speed - -open Fs.Units - -module Units = - - /// Feet per second - [] type fps = Length.Units.ft / Time.Units.s - - /// Meter per second - [] type mps = Length.Units.m / Time.Units.s - - /// Kilometer per hour - [] type kph = Length.Units.km / Time.Units.hr - - /// Mile per hour - [] type mph = Length.Units.mi / Time.Units.hr - -open Units -open Fs.Units.Length -open Fs.Units.Time - -module FootPerSecond = - - let create (x: float) = x * 1.0 - let toMetersPerSecond (x: float) = - let length = Foot.create 1 |> Foot.toMeters - let time = Second.create 1 - x * length / time / 1.0 - let toKilometersPerHour (x: float) = - let length = Foot.create 1 |> Foot.toKilometers - let time = Second.create 1 |> Second.toHours - x * length / time / 1.0 - let toMilesPerHour (x: float) = - let length = Foot.create 1 |> Foot.toMiles - let time = Second.create 1 |> Second.toHours - x * length / time / 1.0 - -module MeterPerSecond = - - let create (x: float) = x * 1.0 - let toFeetPerSecond (x: float) = - let length = Meter.create 1 |> Meter.toFeet - let time = Second.create 1 - x * length / time / 1.0 - let toKilometersPerHour (x: float) = - let length = Meter.create 1 |> Meter.toKilometers - let time = Second.create 1 |> Second.toHours - x * length / time / 1.0 - let toMilesPerHour (x: float) = - let length = Meter.create 1 |> Meter.toMiles - let time = Second.create 1 |> Second.toHours - x * length / time / 1.0 - -module KilometerPerHour = - - let create (x: float) = x * 1.0 - let toFeetPerSecond (x: float) = - let length = Kilometer.create 1 |> Kilometer.toFeet - let time = Hour.create 1 |> Hour.toSeconds - x * length / time / 1.0 - let toMetersPerSecond (x: float) = - let length = Kilometer.create 1 |> Kilometer.toMeters - let time = Hour.create 1 |> Hour.toSeconds - x * length / time / 1.0 - let toMilesPerHour (x: float) = - let length = Kilometer.create 1 |> Kilometer.toMiles - let time = Hour.create 1 - x * length / time / 1.0 - -module MilePerHour = - - let create (x: float) = x * 1.0 - let toFeetPerSecond (x: float) = - let length = Mile.create 1 |> Mile.toFeet - let time = Hour.create 1 |> Hour.toSeconds - x * length / time / 1.0 - let toMetersPerSecond (x: float) = - let length = Mile.create 1 |> Mile.toMeters - let time = Hour.create 1 |> Hour.toSeconds - x * length / time / 1.0 - let toKilometersPerHour (x: float) = - let length = Mile.create 1 |> Mile.toKilometers - let time = Hour.create 1 - x * length / time / 1.0 \ No newline at end of file diff --git a/Fs.Units/Compound/Volume.fs b/Fs.Units/Compound/Volume.fs deleted file mode 100644 index fd639f4..0000000 --- a/Fs.Units/Compound/Volume.fs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Fs.Units.Volume - -open Fs.Units - -module Units = - - /// Cubic inch - [] type in3 = Length.Units.inch * Length.Units.inch * Length.Units.inch - - /// Cubic foot - [] type ft3 = Length.Units.ft * Length.Units.ft * Length.Units.ft - - /// Cubic centimeter - [] type cm3 = Length.Units.cm * Length.Units.cm * Length.Units.cm - - /// Cubic meter - [] type m3 = Length.Units.m * Length.Units.m * Length.Units.m - -open Units -open Fs.Units.Length - -module CubicInch = - - let create (x: float) = x * 1.0 - let toCubicFeet (x: float) = - let length = Inch.create 1 |> Inch.toFeet - x * length * length * length / 1.0 - let toCubicCentimeters (x: float) = - let length = Inch.create 1 |> Inch.toCentimeters - x * length * length * length / 1.0 - let toCubicMeters (x: float) = - let length = Inch.create 1 |> Inch.toMeters - x * length * length * length / 1.0 - -module CubicFoot = - - let create (x: float) = x * 1.0 - let toCubicInches (x: float) = - let length = Foot.create 1 |> Foot.toInches - x * length * length * length / 1.0 - let toCubicCentimeters (x: float) = - let length = Foot.create 1 |> Foot.toCentimeters - x * length * length * length / 1.0 - let toCubicMeters (x: float) = - let length = Foot.create 1 |> Foot.toMeters - x * length * length * length / 1.0 - -module CubicCentimeter = - - let create (x: float) = x * 1.0 - let toCubicInches (x: float) = - let length = Centimeter.create 1 |> Centimeter.toInches - x * length * length * length / 1.0 - let toCubicFeet (x: float) = - let length = Centimeter.create 1 |> Centimeter.toFeet - x * length * length * length / 1.0 - let toCubicMeters (x: float) = - let length = Centimeter.create 1 |> Centimeter.toMeters - x * length * length * length / 1.0 - -module CubicMeter = - - let create (x: float) = x * 1.0 - let toCubicInches (x: float) = - let length = Meter.create 1 |> Meter.toInches - x * length * length * length / 1.0 - let toCubicFeet (x: float) = - let length = Meter.create 1 |> Meter.toFeet - x * length * length * length / 1.0 - let toCubicCentimeters (x: float) = - let length = Meter.create 1 |> Meter.toCentimeters - x * length * length * length / 1.0 - diff --git a/Fs.Units/Simple/FuelEconomy.fs b/Fs.Units/Simple/FuelEconomy.fs deleted file mode 100644 index e3125df..0000000 --- a/Fs.Units/Simple/FuelEconomy.fs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Fs.Units.FuelEconomy - -module Units = - - /// Kilometer per liter - [] type kml - - /// Mile per gallon - [] type mpg - -open Units - -module KilometerPerLiter = - - let create (x: float) = x * 1.0 - let toMilesPerGallon (x: float) = x * 2.35215 / 1.0 - -module MilePerGallon = - - let create (x: float) = x * 1.0 - let toKilometersPerLiter (x: float) = x / 2.35215 * 1.0 diff --git a/Fs.Units/Simple/Temperature.fs b/Fs.Units/Simple/Temperature.fs deleted file mode 100644 index 373bf75..0000000 --- a/Fs.Units/Simple/Temperature.fs +++ /dev/null @@ -1,45 +0,0 @@ -namespace Fs.Units.Temperature - -module Units = - - /// Kelvin - [] type K - - /// Celsius - [] type C - - /// Fahrenheit - [] type F - - /// Rankine - [] type R - -open Units - -module Kelvin = - - let create (x: float) = x * 1.0 - let toCelsius (x: float) = (x - 273.15) / 1.0 * 1.0 - let toFahrenheit (x: float) = ((x - 273.15) * (9.0/5.0) + 32.0) / 1.0 * 1.0 - let toRankine (x: float) = (x * 1.8) / 1.0 * 1.0 - -module Celsius = - - let create (x: float) = x * 1.0 - let toKelvin (x: float) = (x + 273.15) / 1.0 * 1.0 - let toFahrenheit (x: float) = ((x * (9.0/5.0)) + 32.0) / 1.0 * 1.0 - let toRankine (x: float) = ((x + 273.15) * 1.8) / 1.0 * 1.0 - -module Fahrenheit = - - let create (x: float) = x * 1.0 - let toKelvin (x: float) = ((x - 32.0) * (5.0/9.0) + 273.15) / 1.0 * 1.0 - let toCelsius (x: float) = ((x - 32.0) * (5.0/9.0)) / 1.0 * 1.0 - let toRankine (x: float) = (x + 459.67) / 1.0 * 1.0 - -module Rankine = - - let create (x: float) = x * 1.0 - let toKelvin (x: float) = (x * (5.0/9.0)) / 1.0 * 1.0 - let toCelsius (x: float) = ((x - 491.67) * (5.0/9.0)) / 1.0 * 1.0 - let toFahrenheit (x: float) = (x - 459.67) / 1.0 * 1.0 \ No newline at end of file diff --git a/README.md b/README.md index df60aa5..5117681 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,66 @@ -# FS.Units +# Fs.Units -[![NuGet version (Fs.Units)](https://img.shields.io/nuget/v/Fs.Units.svg?style=flat-square)](https://www.nuget.org/packages/Fs.Units/) -[![NuGet version (Fs.Units.CSharp)](https://img.shields.io/nuget/v/Fs.Units.CSharp.svg?style=flat-square)](https://www.nuget.org/packages/Fs.Units.CSharp/) -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) -[![GitHub Releases](https://img.shields.io/github/release/1eyewonder/Fs.Units.svg)](https://github.com/1eyewonder/Fs.Units/releases) -[![GitHub Issues](https://img.shields.io/github/issues/1eyewonder/Fs.Units.svg)](https://github.com/1eyewonder/Fs.Units/issues) - -A simple library for working with units of measure in .NET. +A simple library for working with units of measure in .NET. The goal of this library is to assist developers with quick proof of concepts as well as full functioning projects which involve common units of measure. Feedback and assistance are welcome! +## NuGet + +| Package | Release | Pre-Release | License | +| ------- |--------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| +| Fs.Units | [![NuGet version (Fs.Units)](https://buildstats.info/nuget/Fs.Units)](https://www.nuget.org/packages/Fs.Units/) | [![NuGet](https://buildstats.info/nuget/Fs.Units?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) | +| Fs.Units.CSharp | [![NuGet version (Fs.Units.CSharp)](https://buildstats.info/nuget/Fs.Units.CSharp)](https://www.nuget.org/packages/Fs.Units.CSharp/) | [![NuGet](https://buildstats.info/nuget/Fs.Units.CSharp?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units.CSharp/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) | + +## Builds + +| GitHub Actions | +|:----------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| [![GitHub Actions](https://github.com/1eyewonder/Fs.Units/workflows/Build%20main/badge.svg)](https://github.com/1eyewonder/Fs.Units/actions?query=branch%3Amain) | +| [![Build History](https://buildstats.info/github/chart/1eyewonder/Fs.Units?branch=main)](https://github.com/1eyewonder/Fs.Units/actions?query=branch%3Amain) | + +## Table of Contents + +- [Fs.Units](#fsunits) + - [NuGet](#nuget) + - [Builds](#builds) + - [Table of Contents](#table-of-contents) + - [Unit Types](#unit-types) + - [Examples](#examples) + - [F#](#f) + - [Explicit Conversion Example](#explicit-conversion-example) + - [Implicit Conversion Example](#implicit-conversion-example) + - [C#](#c) + - [Example](#example) + - [Supported Unit Categories](#supported-unit-categories) + - [Simple](#simple) + - [Length](#length) + - [Time](#time) + - [Mass](#mass) + - [Temperature](#temperature) + - [Angle](#angle) + - [DataStorage](#datastorage) + - [Frequency](#frequency) + - [Illuminance](#illuminance) + - [Current](#current) + - [Compound](#compound) + - [Area](#area) + - [Volume](#volume) + - [FuelEconomy](#fueleconomy) + - [Inertia](#inertia) + - [Speed](#speed) + - [Force](#force) + - [DataTransferRate](#datatransferrate) + - [Density](#density) + - [Pressure](#pressure) + - [Power](#power) + - [Energy](#energy) + - [ElectricCharge](#electriccharge) + - [ElectromotiveForce](#electromotiveforce) + - [Capacitance](#capacitance) + - [Inductance](#inductance) + ## Unit Types - **Simple Units:** A basic unit of measure @@ -23,38 +72,221 @@ Feedback and assistance are welcome! [] type in2 = inch * inch ``` -## Project Structure - -Fs.Units aims to make things as simple as possible. The project is broken down into two main parts: -- Simple Units -- Compound Units +## Examples ### F# -- **Fs.Units.[UnitType]** namespace - - **Fs.Units.[UnitType].Units** module - - Contains the definition of the unit of measure i.e. inches, kilograms, etc. - - **Fs.Units.[UnitType].[UnitName]** module - - Module containing the conversion methods for the given unit of measure +#### Explicit Conversion Example -#### Example ```fsharp -open Fs.Units.Length +open Fs.Units let valueInFeet = Inch.create 1.0 |> Inch.toFeet // float ``` -
+#### Implicit Conversion Example + +For some compound units, implicit conversion is supported. This allows for a more natural syntax. + +```fsharp +open Fs.Units + +let thing1 = Coulomb.create 1.0 // float +let thing2 = 1. * 1. // float + +let totalThing = area1 + area2 // float +``` + +```fsharp +open Fs.Units + +let thing1 = Liter.create 1.0 // float +let thing2 = 1. * 1. * 1. // float + +let totalThing = area1 + area2 // float +``` + +#### Helper Functions + +Some helper functions are provided to prevent boilerplate code for common math operations such as min, max, abs, etc. + +```fsharp +open Fs.Units +open Fs.Units.Helpers + +let value1 = Foot.create 1.0 // float +let value2 = Foot.create 2.0 // float +let maxValue = max value1 value2 // float +``` ### C# -- **Fs.Units.CSharp.[UnitType]** namespace - - Contains the extension methods for the given type of unit of measure #### Example ```csharp -using Fs.Units.CSharp.Length; +using Fs.Units.CSharp; var valueInFeet = 1d.InchToFeet(); // double ``` -
\ No newline at end of file +## Supported Unit Categories + +### Simple + +#### Length + - Inch + - Foot + - Yard + - Mile + - Millimeter + - Centimeter + - Decimeter + - Meter + - Kilometer + - NauticalMile + - Chain + - Furlong + - League + - Hand + - Rod +#### Time + - Nanosecond + - Microsecond + - Millisecond + - Second + - Minute + - Hour + - Day + - Week + - Fortnight + - Month + - Year + - Decade + - Century + - Millenium + - Eon +#### Mass + - Milligram + - Gram + - Kilogram + - Pound mass +#### Temperature + - Kelvin + - Celsius + - Fahrenheit + - Rankine +#### Angle + - Degree + - Radian + - Gradian + - Revolution + - Arcminute + - Arcsecond +#### DataStorage + - Bit + - Kilobit + - Megabit + - Gigabit + - Terabit + - Petabit + - Byte + - Kilobyte + - Megabyte + - Gigabyte + - Terabyte + - Petabyte +#### Frequency + - Hertz + - Kilohertz + - Megahertz + - Gigahertz +#### Illuminance + - Footcandle + - Lux + - Phot + - Nox +#### Current + - Microampere + - Milliampere + - Ampere + - Biot + +### Compound + +#### Area + - SquareInch + - SquareFoot + - SquareCentimeter + - SquareMeter +#### Volume + - CubicInch + - CubicFoot + - CubicCentimeter + - CubicMeter + - Liter + - Gallon +#### FuelEconomy + - MilesPerGallon + - KilometersPerLiter +#### Inertia + - QuarticInch + - QuarticCentimeter +#### Speed + - FeetPerSecond + - MetersPerSecond + - MilesPerHour + - KilometersPerHour +#### Force + - Newton + - PoundForce + - Dyne + - Kip +#### DataTransferRate + - Baud + - BitsPerSecond + - KilobitsPerSecond + - MegabitsPerSecond + - GigabitsPerSecond + - TerabitsPerSecond + - PetabitsPerSecond + - BytesPerSecond + - KilobytesPerSecond + - MegabytesPerSecond + - GigabytesPerSecond + - TerabytesPerSecond + - PetabytesPerSecond +#### Density + - KilogramsPerCubicMeter + - GramsPerCubicCentimeter + - PoundMassPerCubicFoot + - PoundMassPerCubicInch +#### Pressure + - Pascal + - PoundsPerSquareInch +#### Power + - Watt + - KiloWatt + - ImperialHorsepower + - TonOfRefrigeration +#### Energy + - Joules + - KiloJoules + - BritishThermalUnits + - calories + - Quads + - Q +#### ElectricCharge + - Coulomb + - AmpereHour + - AmpereSecond +#### ElectromotiveForce + - Microvolts + - Millivolts + - Volts + - Kilovolts + - Megavolts +#### Capacitance + - Farads +#### Inductance + - MicroHenrys + - MilliHenrys + - Henrys \ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 0000000..4fc8db0 --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1,14 @@ +### 2.0.0 - 2023-12-06 +- Convert library to .NET Standard 2.0 +- Namespace reorganization for better ergonomics (Only need to `open Fs.Units` now) +- Project folder restructure +- Add build project +- Add dotnet tooling +- Add .editorconfig +- Add Decimeter to Length modules +- Add Liter to Volume modules +- Add Gallon to Volume modules +- Moved FuelEconomy to compound folder and update types to include simple unit components + +### 1.0.0 - 2022-12-12 +- Initial release \ No newline at end of file diff --git a/Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs similarity index 84% rename from Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs rename to benchmarks/Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs index 0251969..cdc3666 100644 --- a/Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs +++ b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/BenchmarkTests.cs @@ -1,11 +1,10 @@ using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; - namespace Fs.Units.CSharp.Tests.Benchmark; public static class TestFootExtensions { - public static double ToInches(this double value) => Length.Foot.toInches(value); + public static double ToInches(this double value) => Units.Length.Foot.toInches(value); } [SimpleJob(RuntimeMoniker.Net60)] diff --git a/Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs similarity index 97% rename from Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs rename to benchmarks/Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs index 55c3175..bc34f58 100644 --- a/Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs +++ b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/FluentInterfaceContent.cs @@ -1,5 +1,7 @@ namespace Fs.Units.CSharp.Tests.Benchmark; +using Fs.Units; + public interface IMeasure { public double Value { get; } diff --git a/benchmarks/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj new file mode 100644 index 0000000..492dc7a --- /dev/null +++ b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/Fs.Units.CSharp.Tests.Benchmark.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + enable + enable + default + false + + + + + + \ No newline at end of file diff --git a/Fs.Units.CSharp.Tests.Benchmark/Program.cs b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/Program.cs similarity index 100% rename from Fs.Units.CSharp.Tests.Benchmark/Program.cs rename to benchmarks/Fs.Units.CSharp.Tests.Benchmark/Program.cs diff --git a/benchmarks/Fs.Units.CSharp.Tests.Benchmark/paket.references b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/paket.references new file mode 100644 index 0000000..2e20700 --- /dev/null +++ b/benchmarks/Fs.Units.CSharp.Tests.Benchmark/paket.references @@ -0,0 +1,2 @@ +group Benchmarks + BenchmarkDotNet \ No newline at end of file diff --git a/Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj b/benchmarks/Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj similarity index 56% rename from Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj rename to benchmarks/Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj index 73bac81..d1db612 100644 --- a/Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj +++ b/benchmarks/Fs.Units.Tests.Benchmark/Fs.Units.Tests.Benchmark.fsproj @@ -2,14 +2,15 @@ Exe - net6.0 + net8.0 false + - + - + \ No newline at end of file diff --git a/benchmarks/Fs.Units.Tests.Benchmark/Program.fs b/benchmarks/Fs.Units.Tests.Benchmark/Program.fs new file mode 100644 index 0000000..d7038ea --- /dev/null +++ b/benchmarks/Fs.Units.Tests.Benchmark/Program.fs @@ -0,0 +1,41 @@ +open System.Runtime.Versioning +open BenchmarkDotNet.Attributes +open BenchmarkDotNet.Running +open Fs.Units + +let myTestData = [ 1.; 2.; 3.; 4.; 5. ] +let ft2Data = myTestData |> List.map SquareFoot.create + +let newtonData = myTestData |> List.map Newton.create + +[] +type Benchmarks() = + + //ft2 to in2 + let testFunction1 (x: float) = x * 144.0 / 1.0 + + //ft2 to in2 + let testFunction2 (x: float) = + let a = Foot.create 1 |> Foot.toInches + x * (a * a) / 1.0 + + // newton to lbf + let testFunction3 (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toPoundMass + let length = Meter.create 1 |> Meter.toFeet + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + [] + member _.CompoundUnitOfMeasureConvert1() = ft2Data |> List.map testFunction1 + + [] + member _.CompoundUnitOfMeasureConvert2() = ft2Data |> List.map testFunction2 + + [] + member _.CompoundUnitOfMeasureConvert3() = newtonData |> List.map testFunction3 + +[] +let main _ = + let _ = BenchmarkRunner.Run() + 0 diff --git a/benchmarks/Fs.Units.Tests.Benchmark/paket.references b/benchmarks/Fs.Units.Tests.Benchmark/paket.references new file mode 100644 index 0000000..a21a49d --- /dev/null +++ b/benchmarks/Fs.Units.Tests.Benchmark/paket.references @@ -0,0 +1,3 @@ +group Benchmarks + BenchmarkDotNet + FSharp.Core \ No newline at end of file diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..f36588f --- /dev/null +++ b/build.cmd @@ -0,0 +1,4 @@ +echo Restoring dotnet tools... +dotnet tool restore + +dotnet run --project ./build/build.fsproj -- -t %* \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..f151c38 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- + +set -eu +set -o pipefail + +echo "Restoring dotnet tools..." +dotnet tool restore + +FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" \ No newline at end of file diff --git a/build/build.fs b/build/build.fs new file mode 100644 index 0000000..1f29b9e --- /dev/null +++ b/build/build.fs @@ -0,0 +1,251 @@ +open Fake.Api +open Fake.Core +open Fake.IO +open Fake.DotNet +open Fake.IO.FileSystemOperators +open Fake.Core.TargetOperators +open Fake.DotNet.Testing +open Fake.IO.Globbing.Operators +open Fake.Tools +open System +open System.IO +open Fake.BuildServer + +let project = "Fs.Units" +let summary = "A simple library for working with units of measure in .NET" +let configuration = "Release" +let solutionFile = "Fs.Units.sln" + +let rootDir = __SOURCE_DIRECTORY__ ".." + +let srcGlob = rootDir "src/**/*.??proj" + +let testsGlob = rootDir "tests/**/*.??proj" + +let srcAndTest = !!srcGlob ++ testsGlob + +let srcCodeGlob = + !!(rootDir "src/**/*.fs") ++ (rootDir "src/**/*.fsx") + -- (rootDir "src/**/obj/**/*.fs") + +let testsCodeGlob = + !!(rootDir "tests/**/*.fs") ++ (rootDir "tests/**/*.fsx") + -- (rootDir "tests/**/obj/**/*.fs") + +let gitOwner = "1eyewonder" + +let distDir = rootDir @@ "bin" + +let distGlob = distDir @@ "*.nupkg" + +let githubToken = Environment.environVarOrNone "GITHUB_TOKEN" + +let nugetToken = Environment.environVarOrNone "NUGET_TOKEN" + +let failOnBadExitAndPrint (p: ProcessResult) = + if p.ExitCode <> 0 then + p.Errors |> Seq.iter Trace.traceError + + failwithf "failed with exitcode %d" p.ExitCode + +module dotnet = + let watch cmdParam program args = + DotNet.exec cmdParam (sprintf "watch %s" program) args + + let run cmdParam args = DotNet.exec cmdParam "run" args + + let tool optionConfig command args = + DotNet.exec optionConfig (sprintf "%s" command) args |> failOnBadExitAndPrint + + let fantomas args = DotNet.exec id "fantomas" args + +let formatCode _ = + let result = dotnet.fantomas "." + + if not result.OK then + Trace.traceErrorfn "Errors while formatting all files: %A" result.Messages + +let checkFormatCode _ = + let result = dotnet.fantomas "--check ." + + if result.ExitCode = 0 then + Trace.log "No files need formatting" + elif result.ExitCode = 99 then + failwith "Some files need formatting, check output for more info" + else + Trace.logf "Errors while formatting: %A" result.Errors + +let clean _ = + !! "bin" ++ "src/**/bin" ++ "tests/**/bin" ++ "src/**/obj" ++ "tests/**/obj" + |> Shell.cleanDirs + + [ "paket-files/paket.restore.cached" ] |> Seq.iter Shell.rm + +let build _ = + let setParams (defaults: DotNet.BuildOptions) = + { defaults with + NoRestore = true + Configuration = DotNet.BuildConfiguration.fromString configuration + } + + DotNet.build setParams solutionFile + +let restore _ = + Fake.DotNet.Paket.restore (fun p -> { p with ToolType = ToolType.CreateLocalTool() }) + + DotNet.restore id solutionFile + +let dotnetTest ctx = + + let args = [ "--no-build" ] + + DotNet.test + (fun c -> + + { c with + Configuration = DotNet.BuildConfiguration.Release + Common = c.Common |> DotNet.Options.withAdditionalArgs args + }) + solutionFile + +let release = ReleaseNotes.load (rootDir "RELEASE_NOTES.md") + +let generateAssemblyInfo _ = + let getAssemblyInfoAttributes projectName = + [ + AssemblyInfo.Title(projectName) + AssemblyInfo.Product project + AssemblyInfo.Description summary + AssemblyInfo.Version release.AssemblyVersion + AssemblyInfo.FileVersion release.AssemblyVersion + AssemblyInfo.Configuration configuration + ] + + let getProjectDetails (projectPath: string) = + let projectName = Path.GetFileNameWithoutExtension(projectPath) + + (projectPath, projectName, Path.GetDirectoryName(projectPath), (getAssemblyInfoAttributes projectName)) + + srcAndTest + |> Seq.map getProjectDetails + |> Seq.iter (fun (_, _, folderName, attributes) -> + AssemblyInfoFile.createFSharp (folderName "AssemblyInfo.fs") attributes) + +let releaseNotes = String.toLines release.Notes + +let dotnetPack _ = + [ solutionFile ] + |> Seq.iter ( + DotNet.pack (fun p -> + { p with + // ./bin from the solution root matching the "PublishNuget" target WorkingDir + OutputPath = Some distDir + Configuration = DotNet.BuildConfiguration.Release + MSBuildParams = + { MSBuild.CliArguments.Create() with + // "/p" (property) arguments to MSBuild.exe + Properties = [ ("Version", release.NugetVersion); ("PackageReleaseNotes", releaseNotes) ] + } + }) + ) + +let publishNuget _ = + DotNet.nugetPush + (fun c -> + { c with + Common = { c.Common with WorkingDirectory = distDir } + PushParams = + { c.PushParams with + Source = Some "https://www.nuget.org" + ApiKey = nugetToken + } + }) + "*.nupkg" + + Paket.push (fun p -> + { p with + ToolType = ToolType.CreateLocalTool() + PublishUrl = "https://www.nuget.org" + WorkingDir = distDir + ApiKey = + match nugetToken with + | Some s -> s + | _ -> p.ApiKey // assume paket-config was set properly + }) + +let gitRelease _ = + Git.Staging.stageFile "" "RELEASE_NOTES.md" |> ignore + Git.Staging.stageAll "" + Git.Commit.exec "" (sprintf "Bump version to %s\n\n%s" release.NugetVersion releaseNotes) + Git.Branches.push "" + Git.Branches.tag "" release.NugetVersion + Git.Branches.pushTag "" "origin" release.NugetVersion + +let githubRelease _ = + let token = + match githubToken with + | Some s -> s + | _ -> + failwith "please set the github_token environment variable to a github personal access token with repo access." + + let files = !!distGlob + + GitHub.createClientWithToken token + |> GitHub.draftNewRelease + gitOwner + project + release.NugetVersion + (release.SemVer.PreRelease <> None) + (releaseNotes |> Seq.singleton) + |> GitHub.uploadFiles files + |> GitHub.publishDraft + |> Async.RunSynchronously + +let initTargets () = + + BuildServer.install [ GitHubActions.Installer ] + + Option.iter (TraceSecrets.register "") githubToken + Option.iter (TraceSecrets.register "") nugetToken + + Target.create "Clean" clean + Target.create "Build" build + Target.create "Restore" restore + Target.create "Test" dotnetTest + Target.create "CheckFormat" checkFormatCode + Target.create "AssemblyInfo" generateAssemblyInfo + Target.create "DotnetPack" dotnetPack + Target.create "PublishNuget" publishNuget + Target.create "GitRelease" gitRelease + Target.create "GitHubRelease" githubRelease + Target.create "Release" ignore + + // *** Define Dependencies *** + "Clean" + ==> "AssemblyInfo" + ==> "Restore" + ==> "CheckFormat" + ==> "Build" + ==> "Test" + ==> "DotnetPack" + ==> "PublishNuGet" + ==> "GitRelease" + ==> "GitHubRelease" + ==> "Release" + +//----------------------------------------------------------------------------- +// Target Start +//----------------------------------------------------------------------------- +[] +let main argv = + argv + |> Array.toList + |> Context.FakeExecutionContext.Create false "build.fsx" + |> Context.RuntimeContext.Fake + |> Context.setExecutionContext + + initTargets () |> ignore + + Target.runOrDefaultWithArguments "DotnetPack" + + 0 // return an integer exit code diff --git a/build/build.fsproj b/build/build.fsproj new file mode 100644 index 0000000..c209cc3 --- /dev/null +++ b/build/build.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net8.0 + + + + + + + \ No newline at end of file diff --git a/build/paket.references b/build/paket.references new file mode 100644 index 0000000..bc7ec75 --- /dev/null +++ b/build/paket.references @@ -0,0 +1,9 @@ +group Build +Fake.Core.Target +Fake.Core.ReleaseNotes +Fake.DotNet.AssemblyInfoFile +Fake.DotNet.Paket +Fake.DotNet.Testing.Expecto +Fake.Tools.Git +Fake.Api.GitHub +Fake.BuildServer.GitHubActions \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..c82ec4a --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestMinor" + } +} \ No newline at end of file diff --git a/paket.dependencies b/paket.dependencies index 1c497ef..ce3e413 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,10 +1,28 @@ -source "C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" source https://api.nuget.org/v3/index.json -nuget BenchmarkDotNet -nuget Expecto +storage: none + nuget Expecto.FsCheck -nuget FsCheck -nuget FSharp.Core nuget Microsoft.NET.Test.Sdk -nuget YoloDev.Expecto.TestSdk \ No newline at end of file +nuget YoloDev.Expecto.TestSdk + +group Benchmarks + source https://api.nuget.org/v3/index.json + storage: none + framework: net8.0 + nuget FSharp.Core + nuget BenchmarkDotNet + + +group Build + source https://api.nuget.org/v3/index.json + storage: none + framework: net8.0 + nuget Fake.Core.Target + nuget Fake.Core.ReleaseNotes + nuget Fake.DotNet.AssemblyInfoFile + nuget Fake.DotNet.Paket + nuget Fake.DotNet.Testing.Expecto + nuget Fake.Tools.Git + nuget Fake.Api.GitHub + nuget Fake.BuildServer.GitHubActions \ No newline at end of file diff --git a/paket.lock b/paket.lock index d781e64..4a19993 100644 --- a/paket.lock +++ b/paket.lock @@ -1,139 +1,289 @@ +STORAGE: NONE NUGET remote: https://api.nuget.org/v3/index.json - BenchmarkDotNet (0.13.2) - BenchmarkDotNet.Annotations (>= 0.13.2) - restriction: >= netstandard2.0 - CommandLineParser (>= 2.4.3) - restriction: >= netstandard2.0 - Iced (>= 1.17) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.CSharp (>= 3.0) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Runtime (>= 2.2.332302) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Tracing.TraceEvent (>= 3.0.2) - restriction: >= netstandard2.0 - Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: >= netstandard2.0 - Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net6.0) (>= netstandard2.0) - Perfolizer (>= 0.2.1) - restriction: >= netstandard2.0 - System.Management (>= 6.0) - restriction: >= netstandard2.0 - System.Numerics.Vectors (>= 4.5) - restriction: && (< net6.0) (>= netstandard2.0) - System.Reflection.Emit (>= 4.7) - restriction: >= netstandard2.0 - System.Reflection.Emit.Lightweight (>= 4.7) - restriction: >= netstandard2.0 - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: >= netstandard2.0 - BenchmarkDotNet.Annotations (0.13.2) - restriction: >= netstandard2.0 - CommandLineParser (2.9.1) - restriction: >= netstandard2.0 - Expecto (9.0.4) - FSharp.Core (>= 4.6) - restriction: || (>= net461) (>= netstandard2.0) - Mono.Cecil (>= 0.11.3) - restriction: || (>= net461) (>= netstandard2.0) - Expecto.FsCheck (9.0.4) - Expecto (>= 9.0.4) - restriction: || (>= net461) (>= netstandard2.0) - FsCheck (>= 2.14.3) - restriction: || (>= net461) (>= netstandard2.0) - FsCheck (2.16.5) - FSharp.Core (>= 4.0.0.1) - restriction: && (< net452) (>= netstandard1.0) (< netstandard1.6) + Expecto (10.1) - restriction: >= net6.0 + FSharp.Core (>= 7.0.200) - restriction: >= net6.0 + Mono.Cecil (>= 0.11.4 < 1.0) - restriction: >= net6.0 + Expecto.FsCheck (10.1) + Expecto (>= 10.1) - restriction: >= net6.0 + FsCheck (>= 2.16.5 < 3.0) - restriction: >= net6.0 + FsCheck (2.16.6) - restriction: >= net6.0 FSharp.Core (>= 4.2.3) - restriction: || (>= net452) (>= netstandard1.6) - FSharp.Core (7.0) - Iced (1.17) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (7.0) - restriction: >= netstandard2.0 - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.CodeAnalysis.Analyzers (3.3.3) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.Common (4.3.1) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.Analyzers (>= 3.3.3) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 6.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.4) - restriction: >= netstandard2.0 - System.Reflection.Metadata (>= 5.0) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= netstandard2.0 - System.Text.Encoding.CodePages (>= 6.0) - restriction: >= netstandard2.0 - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.CSharp (4.3.1) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.Common (4.3.1) - restriction: >= netstandard2.0 - Microsoft.CodeCoverage (17.4) - restriction: || (>= net462) (>= netcoreapp3.1) - Microsoft.Diagnostics.NETCore.Client (0.2.351802) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (>= 1.1) - restriction: >= netstandard2.0 - Microsoft.Extensions.Logging (>= 2.1.1) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Runtime (2.2.343001) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.NETCore.Client (>= 0.2.251802) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 5.0) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Tracing.TraceEvent (3.0.5) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (>= net462) (>= netstandard1.6) - Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: >= netstandard2.0 - System.Runtime.InteropServices.RuntimeInformation (>= 4.0) - restriction: || (>= net45) (&& (>= netstandard1.3) (< netstandard2.0)) - Microsoft.Extensions.DependencyInjection (7.0) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (>= 7.0) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.Extensions.DependencyInjection.Abstractions (7.0) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (>= 7.0) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.Extensions.Logging (7.0) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (>= 7.0) - restriction: || (>= net462) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.Extensions.DependencyInjection (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.Extensions.Logging.Abstractions (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.Extensions.Options (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.Diagnostics.DiagnosticSource (>= 7.0) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.1)) (&& (>= netstandard2.0) (< netstandard2.1)) - System.ValueTuple (>= 4.5) - restriction: >= net462 - Microsoft.Extensions.Logging.Abstractions (7.0) - restriction: >= netstandard2.0 - System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - Microsoft.Extensions.Options (7.0) - restriction: >= netstandard2.0 - Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.Extensions.Primitives (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.ComponentModel.Annotations (>= 5.0) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) - Microsoft.Extensions.Primitives (7.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - Microsoft.NET.Test.Sdk (17.4) - Microsoft.CodeCoverage (>= 17.4) - restriction: || (>= net462) (>= netcoreapp3.1) - Microsoft.TestPlatform.TestHost (>= 17.4) - restriction: >= netcoreapp3.1 - Microsoft.NETCore.Platforms (7.0) - restriction: || (&& (>= monoandroid) (>= netcoreapp2.0) (< netstandard1.3)) (&& (>= monoandroid) (>= netcoreapp2.1) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (>= monotouch) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (>= net461) (>= netcoreapp2.0)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinios)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinmac)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarintvos)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinwatchos)) (&& (>= netcoreapp2.0) (>= uap10.1)) (&& (< netcoreapp2.0) (>= netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) (&& (>= netcoreapp2.1) (>= uap10.1)) - Microsoft.TestPlatform.ObjectModel (17.4) - restriction: >= netcoreapp3.1 - NuGet.Frameworks (>= 5.11) - restriction: || (>= net462) (>= netstandard2.0) + FSharp.Core (8.0.100) + Microsoft.CodeCoverage (17.8) - restriction: || (>= net462) (>= netcoreapp3.1) + Microsoft.NET.Test.Sdk (17.8) + Microsoft.CodeCoverage (>= 17.8) - restriction: || (>= net462) (>= netcoreapp3.1) + Microsoft.TestPlatform.TestHost (>= 17.8) - restriction: >= netcoreapp3.1 + Microsoft.TestPlatform.ObjectModel (17.8) - restriction: >= netcoreapp3.1 + NuGet.Frameworks (>= 6.5) - restriction: || (>= net462) (>= netstandard2.0) System.Reflection.Metadata (>= 1.6) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.TestPlatform.TestHost (17.4) - restriction: >= netcoreapp3.1 - Microsoft.TestPlatform.ObjectModel (>= 17.4) - restriction: >= netcoreapp3.1 + Microsoft.TestPlatform.TestHost (17.8) - restriction: >= netcoreapp3.1 + Microsoft.TestPlatform.ObjectModel (>= 17.8) - restriction: >= netcoreapp3.1 Newtonsoft.Json (>= 13.0.1) - restriction: >= netcoreapp3.1 - Microsoft.Win32.Registry (5.0) - restriction: && (< net6.0) (>= netstandard2.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Memory (>= 4.5.4) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= uap10.1) - System.Security.AccessControl (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - Mono.Cecil (0.11.4) - restriction: || (>= net461) (>= netstandard2.0) - Newtonsoft.Json (13.0.1) - restriction: >= netcoreapp3.1 - NuGet.Frameworks (6.4) - restriction: >= netcoreapp3.1 - Perfolizer (0.2.1) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.3) - restriction: >= netstandard2.0 - System.Buffers (4.5.1) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= monotouch) (>= netstandard2.0)) (&& (>= net45) (>= netcoreapp3.1) (< netstandard2.0)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (&& (>= net461) (>= netcoreapp3.1)) (&& (>= net462) (>= netcoreapp3.1)) (&& (>= net462) (>= netstandard2.0)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarintvos)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinwatchos)) (&& (< net6.0) (>= netstandard2.0)) (&& (< net6.0) (>= xamarinios)) (&& (< net6.0) (>= xamarinmac)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (< netstandard2.0) (>= wpa81)) - System.CodeDom (7.0) - restriction: >= netstandard2.0 - System.Collections.Immutable (7.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.ComponentModel.Annotations (5.0) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) - System.Diagnostics.DiagnosticSource (7.0) - restriction: || (&& (>= net462) (>= netstandard2.0)) (&& (< net6.0) (>= netstandard2.1)) (&& (>= netstandard2.0) (< netstandard2.1)) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + Mono.Cecil (0.11.5) - restriction: >= net6.0 + Newtonsoft.Json (13.0.3) - restriction: >= netcoreapp3.1 + NuGet.Frameworks (6.8) - restriction: >= netcoreapp3.1 + System.Buffers (4.5.1) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= net45) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= net461) (>= netcoreapp3.1)) (&& (>= net462) (>= netcoreapp3.1)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinios)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinmac)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarintvos)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinwatchos)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (< netstandard2.0) (>= wpa81)) + System.Collections.Immutable (8.0) - restriction: >= netcoreapp3.1 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.Management (7.0) - restriction: >= netstandard2.0 - System.CodeDom (>= 7.0) - restriction: >= netstandard2.0 - System.Memory (4.5.5) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net462) (>= netcoreapp3.1)) (&& (< net6.0) (>= netcoreapp3.1)) (>= netstandard2.0) + System.Memory (4.5.5) - restriction: || (&& (>= net462) (>= netcoreapp3.1)) (&& (< net6.0) (>= netcoreapp3.1)) System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (< uap10.1) (>= wpa81)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Numerics.Vectors (4.5) - restriction: && (< net6.0) (>= netstandard2.0) - System.Reflection.Emit (4.7) - restriction: >= netstandard2.0 - System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= uap10.1) - System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= uap10.1)) - System.Reflection.Emit.Lightweight (4.7) - restriction: >= netstandard2.0 - System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< netstandard2.0) (< win8) (< wp8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< netstandard2.0) (>= wpa81)) (&& (>= portable-net45+win8+wp8+wpa81) (< portable-net45+wp8) (< win8)) (&& (< portable-net45+wp8) (>= win8)) (>= uap10.1) - System.Reflection.Metadata (7.0) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) + System.Reflection.Metadata (8.0) - restriction: >= netcoreapp3.1 + System.Collections.Immutable (>= 8.0) - restriction: || (>= net462) (>= netstandard2.0) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= net45) (>= netcoreapp3.1)) (&& (>= net461) (>= netcoreapp3.1)) (&& (>= net462) (>= net6.0)) (&& (>= net462) (>= netcoreapp3.1)) (&& (>= net462) (>= netstandard2.1)) (&& (>= net6.0) (< net7.0)) (&& (>= net6.0) (< netstandard2.1)) (&& (< net6.0) (>= netcoreapp3.1)) (&& (< net6.0) (>= netstandard2.1)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (>= uap10.1)) (&& (>= netcoreapp3.1) (>= wpa81)) (>= netstandard2.0) - System.Runtime.InteropServices.RuntimeInformation (4.3) - restriction: && (>= net45) (>= netstandard2.0) - System.Security.AccessControl (6.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (< net6.0) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (&& (>= net461) (>= netstandard2.0)) (&& (< net6.0) (>= netcoreapp2.1)) (&& (< net6.0) (>= netstandard2.0) (>= xamarintvos)) (&& (< net6.0) (>= netstandard2.0) (>= xamarinwatchos)) (&& (< net6.0) (>= xamarinios)) (&& (< net6.0) (>= xamarinmac)) (&& (>= netstandard2.0) (>= uap10.1)) - System.Security.Principal.Windows (>= 5.0) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Security.Principal.Windows (5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (< net6.0) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (&& (>= net461) (>= netstandard2.0)) (&& (< net6.0) (>= netcoreapp2.1)) (&& (< net6.0) (>= netstandard2.0) (>= xamarintvos)) (&& (< net6.0) (>= netstandard2.0) (>= xamarinwatchos)) (&& (< net6.0) (>= xamarinios)) (&& (< net6.0) (>= xamarinmac)) (&& (>= netstandard2.0) (>= uap10.1)) - Microsoft.NETCore.Platforms (>= 5.0) - restriction: || (&& (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) - System.Text.Encoding.CodePages (7.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.Threading.Tasks.Extensions (4.5.4) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< win8)) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net461) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= wp8) - System.ValueTuple (4.5) - restriction: && (>= net462) (>= netstandard2.0) - YoloDev.Expecto.TestSdk (0.13.3) - Expecto (>= 9.0 < 10.0) - restriction: >= netcoreapp3.1 - FSharp.Core (>= 4.6.2) - restriction: >= netcoreapp3.1 - System.Collections.Immutable (>= 6.0) - restriction: >= netcoreapp3.1 + System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (< netcoreapp2.1) (>= netcoreapp3.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= net45) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= net461) (>= netcoreapp3.1)) (&& (>= net462) (>= net6.0)) (&& (>= net462) (>= netcoreapp3.1)) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinios)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinmac)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarintvos)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinwatchos)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (< netstandard2.0) (>= wpa81)) (&& (>= netcoreapp3.1) (>= uap10.1)) + YoloDev.Expecto.TestSdk (0.14.3) + Expecto (>= 10.0 < 11.0) - restriction: >= net6.0 + FSharp.Core (>= 7.0.200) - restriction: >= net6.0 + System.Collections.Immutable (>= 6.0) - restriction: >= net6.0 + +GROUP Benchmarks +STORAGE: NONE +RESTRICTION: == net8.0 +NUGET + remote: https://api.nuget.org/v3/index.json + BenchmarkDotNet (0.13.10) + BenchmarkDotNet.Annotations (>= 0.13.10) + CommandLineParser (>= 2.9.1) + Gee.External.Capstone (>= 2.3) + Iced (>= 1.17) + Microsoft.CodeAnalysis.CSharp (>= 4.1) + Microsoft.Diagnostics.Runtime (>= 2.2.332302) + Microsoft.Diagnostics.Tracing.TraceEvent (>= 3.0.2) + Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) + Perfolizer (0.2.1) + System.Management (>= 5.0) + BenchmarkDotNet.Annotations (0.13.10) + CommandLineParser (2.9.1) + FSharp.Core (8.0.100) + Gee.External.Capstone (2.3) + Iced (1.20) + Microsoft.CodeAnalysis.Analyzers (3.3.4) + Microsoft.CodeAnalysis.Common (4.7) + Microsoft.CodeAnalysis.Analyzers (>= 3.3.4) + System.Collections.Immutable (>= 7.0) + System.Reflection.Metadata (>= 7.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) + Microsoft.CodeAnalysis.CSharp (4.7) + Microsoft.CodeAnalysis.Common (4.7) + Microsoft.Diagnostics.NETCore.Client (0.2.452401) + Microsoft.Extensions.Logging (>= 6.0) + Microsoft.Diagnostics.Runtime (3.1.456101) + Microsoft.Diagnostics.NETCore.Client (>= 0.2.410101) + System.Collections.Immutable (>= 6.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) + Microsoft.Diagnostics.Tracing.TraceEvent (3.1.6) + Microsoft.Win32.Registry (>= 4.4) + System.Runtime.CompilerServices.Unsafe (>= 5.0) + Microsoft.DotNet.PlatformAbstractions (3.1.6) + Microsoft.Extensions.DependencyInjection (8.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0) + Microsoft.Extensions.DependencyInjection.Abstractions (8.0) + Microsoft.Extensions.Logging (8.0) + Microsoft.Extensions.DependencyInjection (>= 8.0) + Microsoft.Extensions.Logging.Abstractions (>= 8.0) + Microsoft.Extensions.Options (>= 8.0) + Microsoft.Extensions.Logging.Abstractions (8.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0) + Microsoft.Extensions.Options (8.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0) + Microsoft.Extensions.Primitives (>= 8.0) + Microsoft.Extensions.Primitives (8.0) + Microsoft.Win32.Registry (5.0) + System.Security.AccessControl (>= 5.0) + System.Security.Principal.Windows (>= 5.0) + Perfolizer (0.2.1) + System.Memory (>= 4.5.3) + System.CodeDom (8.0) + System.Collections.Immutable (8.0) + System.Management (8.0) + System.CodeDom (>= 8.0) + System.Memory (4.5.5) + System.Reflection.Metadata (8.0) + System.Collections.Immutable (>= 8.0) + System.Runtime.CompilerServices.Unsafe (6.0) + System.Security.AccessControl (6.0) + System.Security.Principal.Windows (5.0) + +GROUP Build +STORAGE: NONE +RESTRICTION: == net8.0 +NUGET + remote: https://api.nuget.org/v3/index.json + BlackFox.VsWhere (1.1) + FSharp.Core (>= 4.2.3) + Microsoft.Win32.Registry (>= 4.7) + Fake.Api.GitHub (6.0) + FSharp.Core (>= 6.0.3) + Octokit (>= 0.50) + Fake.BuildServer.GitHubActions (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.CommandLineParsing (6.0) + FParsec (>= 1.1.1) + FSharp.Core (>= 6.0.3) + Fake.Core.Context (6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.Environment (6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.FakeVar (6.0) + Fake.Core.Context (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.Process (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.FakeVar (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + System.Collections.Immutable (>= 6.0) + Fake.Core.ReleaseNotes (6.0) + Fake.Core.SemVer (>= 6.0) + Fake.Core.String (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.SemVer (6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.String (6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.Target (6.0) + Fake.Core.CommandLineParsing (>= 6.0) + Fake.Core.Context (>= 6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.FakeVar (>= 6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Control.Reactive (>= 5.0.2) + FSharp.Core (>= 6.0.3) + Fake.Core.Tasks (6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.Trace (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.FakeVar (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Core.Xml (6.0) + Fake.Core.String (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.DotNet.AssemblyInfoFile (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.DotNet.Cli (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.DotNet.MSBuild (>= 6.0) + Fake.DotNet.NuGet (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + Mono.Posix.NETStandard (>= 1.0) + Newtonsoft.Json (>= 13.0.1) + Fake.DotNet.MSBuild (6.0) + BlackFox.VsWhere (>= 1.1) + Fake.Core.Environment (>= 6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + MSBuild.StructuredLogger (>= 2.1.545) + Fake.DotNet.NuGet (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.SemVer (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Tasks (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.Core.Xml (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + Fake.Net.Http (>= 6.0) + FSharp.Core (>= 6.0.3) + Newtonsoft.Json (>= 13.0.1) + NuGet.Protocol (>= 6.0) + Fake.DotNet.Paket (6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.DotNet.Cli (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.DotNet.Testing.Expecto (6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.Testing.Common (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.IO.FileSystem (6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Net.Http (6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Testing.Common (6.0) + Fake.Core.Trace (>= 6.0) + FSharp.Core (>= 6.0.3) + Fake.Tools.Git (6.0) + Fake.Core.Environment (>= 6.0) + Fake.Core.Process (>= 6.0) + Fake.Core.SemVer (>= 6.0) + Fake.Core.String (>= 6.0) + Fake.Core.Trace (>= 6.0) + Fake.IO.FileSystem (>= 6.0) + FSharp.Core (>= 6.0.3) + FParsec (1.1.1) + FSharp.Core (>= 4.3.4) + FSharp.Control.Reactive (5.0.5) + FSharp.Core (>= 4.7.2) + System.Reactive (>= 5.0 < 6.0) + FSharp.Core (8.0.100) + Microsoft.Build.Framework (17.8.3) + Microsoft.Build.Utilities.Core (17.8.3) + Microsoft.Build.Framework (>= 17.8.3) + Microsoft.NET.StringTools (>= 17.8.3) + Microsoft.VisualStudio.Setup.Configuration.Interop (>= 3.2.2146) + System.Collections.Immutable (>= 7.0) + System.Configuration.ConfigurationManager (>= 7.0) + Microsoft.NET.StringTools (17.8.3) + Microsoft.VisualStudio.Setup.Configuration.Interop (3.8.2112) + Microsoft.Win32.Registry (5.0) + System.Security.AccessControl (>= 5.0) + System.Security.Principal.Windows (>= 5.0) + Mono.Posix.NETStandard (1.0) + MSBuild.StructuredLogger (2.2.2) + Microsoft.Build.Framework (>= 17.5) + Microsoft.Build.Utilities.Core (>= 17.5) + Newtonsoft.Json (13.0.3) + NuGet.Common (6.8) + NuGet.Frameworks (>= 6.8) + NuGet.Configuration (6.8) + NuGet.Common (>= 6.8) + System.Security.Cryptography.ProtectedData (>= 4.4) + NuGet.Frameworks (6.8) + NuGet.Packaging (6.8) + Newtonsoft.Json (>= 13.0.3) + NuGet.Configuration (>= 6.8) + NuGet.Versioning (>= 6.8) + System.Security.Cryptography.Pkcs (>= 6.0.4) + NuGet.Protocol (6.8) + NuGet.Packaging (>= 6.8) + NuGet.Versioning (6.8) + Octokit (9.0) + System.Collections.Immutable (8.0) + System.Configuration.ConfigurationManager (8.0) + System.Diagnostics.EventLog (>= 8.0) + System.Security.Cryptography.ProtectedData (>= 8.0) + System.Diagnostics.EventLog (8.0) + System.Formats.Asn1 (8.0) + System.Reactive (5.0) + System.Security.AccessControl (6.0) + System.Security.Cryptography.Pkcs (8.0) + System.Formats.Asn1 (>= 8.0) + System.Security.Cryptography.ProtectedData (8.0) + System.Security.Principal.Windows (5.0) diff --git a/src/Fs.Units.CSharp/AssemblyInfo.fs b/src/Fs.Units.CSharp/AssemblyInfo.fs new file mode 100644 index 0000000..e8917f4 --- /dev/null +++ b/src/Fs.Units.CSharp/AssemblyInfo.fs @@ -0,0 +1,19 @@ +// Auto-Generated by FAKE; do not edit +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "Fs.Units.CSharp" + let [] AssemblyProduct = "Fs.Units" + let [] AssemblyDescription = "A simple library for working with units of measure in .NET" + let [] AssemblyVersion = "2.0.0" + let [] AssemblyFileVersion = "2.0.0" + let [] AssemblyConfiguration = "Release" diff --git a/Fs.Units.CSharp/Compound/Area.cs b/src/Fs.Units.CSharp/Compound/Area.cs similarity index 61% rename from Fs.Units.CSharp/Compound/Area.cs rename to src/Fs.Units.CSharp/Compound/Area.cs index b33a9b5..460359e 100644 --- a/Fs.Units.CSharp/Compound/Area.cs +++ b/src/Fs.Units.CSharp/Compound/Area.cs @@ -1,30 +1,30 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Area; +namespace Fs.Units.CSharp; public static class SquareInchExtensions { - public static double SquareInchToSquareFeet(this double x) => SquareInch.toSquareFeet(x); - public static double SquareInchToSquareCentimeters(this double x) => SquareInch.toSquareCentimeters(x); - public static double SquareInchToSquareMeters(this double x) => SquareInch.toSquareMeters(x); + public static double SquareInchToSquareFeet(this double x) => Units.Area.SquareInch.toSquareFeet(x); + public static double SquareInchToSquareCentimeters(this double x) => Units.Area.SquareInch.toSquareCentimeters(x); + public static double SquareInchToSquareMeters(this double x) => Units.Area.SquareInch.toSquareMeters(x); } public static class SquareFootExtensions { - public static double SquareFootToSquareInches(this double x) => SquareFoot.toSquareInches(x); - public static double SquareFootToSquareCentimeters(this double x) => SquareFoot.toSquareCentimeters(x); - public static double SquareFootToSquareMeters(this double x) => SquareFoot.toSquareMeters(x); + public static double SquareFootToSquareInches(this double x) => Units.Area.SquareFoot.toSquareInches(x); + public static double SquareFootToSquareCentimeters(this double x) => Units.Area.SquareFoot.toSquareCentimeters(x); + public static double SquareFootToSquareMeters(this double x) => Units.Area.SquareFoot.toSquareMeters(x); } public static class SquareCentimeterExtensions { - public static double SquareCentimeterToSquareInches(this double x) => SquareCentimeter.toSquareInches(x); - public static double SquareCentimeterToSquareFeet(this double x) => SquareCentimeter.toSquareFeet(x); - public static double SquareCentimeterToSquareMeters(this double x) => SquareCentimeter.toSquareMeters(x); + public static double SquareCentimeterToSquareInches(this double x) => Units.Area.SquareCentimeter.toSquareInches(x); + public static double SquareCentimeterToSquareFeet(this double x) => Units.Area.SquareCentimeter.toSquareFeet(x); + public static double SquareCentimeterToSquareMeters(this double x) => Units.Area.SquareCentimeter.toSquareMeters(x); } public static class SquareMeterExtensions { - public static double SquareMeterToSquareInches(this double x) => SquareMeter.toSquareInches(x); - public static double SquareMeterToSquareFeet(this double x) => SquareMeter.toSquareFeet(x); - public static double SquareMeterToSquareCentimeters(this double x) => SquareMeter.toSquareCentimeters(x); + public static double SquareMeterToSquareInches(this double x) => Units.Area.SquareMeter.toSquareInches(x); + public static double SquareMeterToSquareFeet(this double x) => Units.Area.SquareMeter.toSquareFeet(x); + public static double SquareMeterToSquareCentimeters(this double x) => Units.Area.SquareMeter.toSquareCentimeters(x); } \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/DataTransferRate.cs b/src/Fs.Units.CSharp/Compound/DataTransferRate.cs new file mode 100644 index 0000000..157d5f4 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/DataTransferRate.cs @@ -0,0 +1,210 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class BaudExtensions +{ + public static double BaudToBitsPerSecond(this double x) => Units.DataTransferRate.Baud.toBitsPerSecond(x); + public static double BaudToKilobitsPerSecond(this double x) => Units.DataTransferRate.Baud.toKilobitsPerSecond(x); + public static double BaudToMegabitsPerSecond(this double x) => Units.DataTransferRate.Baud.toMegabitsPerSecond(x); + public static double BaudToGigabitsPerSecond(this double x) => Units.DataTransferRate.Baud.toGigabitsPerSecond(x); + public static double BaudToTerabitsPerSecond(this double x) => Units.DataTransferRate.Baud.toTerabitsPerSecond(x); + public static double BaudToPetabitsPerSecond(this double x) => Units.DataTransferRate.Baud.toPetabitsPerSecond(x); + public static double BaudToBytesPerSecond(this double x) => Units.DataTransferRate.Baud.toBytesPerSecond(x); + public static double BaudToKilobytesPerSecond(this double x) => Units.DataTransferRate.Baud.toKilobytesPerSecond(x); + public static double BaudToMegabytesPerSecond(this double x) => Units.DataTransferRate.Baud.toMegabytesPerSecond(x); + public static double BaudToGigabytesPerSecond(this double x) => Units.DataTransferRate.Baud.toGigabytesPerSecond(x); + public static double BaudToTerabytesPerSecond(this double x) => Units.DataTransferRate.Baud.toTerabytesPerSecond(x); + public static double BaudToPetabytesPerSecond(this double x) => Units.DataTransferRate.Baud.toPetabytesPerSecond(x); +} + +public static class BitPerSecondExtensions +{ + public static double BitPerSecondToBauds(this double x) => Units.DataTransferRate.BitPerSecond.toBauds(x); + public static double BitPerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toKilobitsPerSecond(x); + public static double BitPerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toMegabitsPerSecond(x); + public static double BitPerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toGigabitsPerSecond(x); + public static double BitPerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toTerabitsPerSecond(x); + public static double BitPerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toPetabitsPerSecond(x); + public static double BitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toBytesPerSecond(x); + public static double BitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toKilobytesPerSecond(x); + public static double BitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toMegabytesPerSecond(x); + public static double BitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toGigabytesPerSecond(x); + public static double BitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toTerabytesPerSecond(x); + public static double BitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.BitPerSecond.toPetabytesPerSecond(x); +} + +public static class KilobitPerSecondExtensions +{ + public static double KilobitPerSecondToBauds(this double x) => Units.DataTransferRate.KilobitPerSecond.toBauds(x); + public static double KilobitPerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toBitsPerSecond(x); + public static double KilobitPerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toMegabitsPerSecond(x); + public static double KilobitPerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toGigabitsPerSecond(x); + public static double KilobitPerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toTerabitsPerSecond(x); + public static double KilobitPerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toPetabitsPerSecond(x); + public static double KilobitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toBytesPerSecond(x); + public static double KilobitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toKilobytesPerSecond(x); + public static double KilobitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toMegabytesPerSecond(x); + public static double KilobitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toGigabytesPerSecond(x); + public static double KilobitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toTerabytesPerSecond(x); + public static double KilobitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.KilobitPerSecond.toPetabytesPerSecond(x); +} + +public static class MegabitPerSecondExtensions +{ + public static double MegabitPerSecondToBauds(this double x) => Units.DataTransferRate.MegabitPerSecond.toBauds(x); + public static double MegabitPerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toBitsPerSecond(x); + public static double MegabitPerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toKilobitsPerSecond(x); + public static double MegabitPerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toGigabitsPerSecond(x); + public static double MegabitPerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toTerabitsPerSecond(x); + public static double MegabitPerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toPetabitsPerSecond(x); + public static double MegabitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toBytesPerSecond(x); + public static double MegabitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toKilobytesPerSecond(x); + public static double MegabitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toMegabytesPerSecond(x); + public static double MegabitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toGigabytesPerSecond(x); + public static double MegabitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toTerabytesPerSecond(x); + public static double MegabitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.MegabitPerSecond.toPetabytesPerSecond(x); +} + +public static class GigabitPerSecondExtensions +{ + public static double GigabitPerSecondToBauds(this double x) => Units.DataTransferRate.GigabitPerSecond.toBauds(x); + public static double GigabitPerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toBitsPerSecond(x); + public static double GigabitPerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toKilobitsPerSecond(x); + public static double GigabitPerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toMegabitsPerSecond(x); + public static double GigabitPerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toTerabitsPerSecond(x); + public static double GigabitPerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toPetabitsPerSecond(x); + public static double GigabitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toBytesPerSecond(x); + public static double GigabitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toKilobytesPerSecond(x); + public static double GigabitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toMegabytesPerSecond(x); + public static double GigabitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toGigabytesPerSecond(x); + public static double GigabitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toTerabytesPerSecond(x); + public static double GigabitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.GigabitPerSecond.toPetabytesPerSecond(x); +} + +public static class TerabitPerSecondExtensions +{ + public static double TerabitPerSecondToBauds(this double x) => Units.DataTransferRate.TerabitPerSecond.toBauds(x); + public static double TerabitPerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toBitsPerSecond(x); + public static double TerabitPerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toKilobitsPerSecond(x); + public static double TerabitPerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toMegabitsPerSecond(x); + public static double TerabitPerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toGigabitsPerSecond(x); + public static double TerabitPerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toPetabitsPerSecond(x); + public static double TerabitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toBytesPerSecond(x); + public static double TerabitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toKilobytesPerSecond(x); + public static double TerabitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toMegabytesPerSecond(x); + public static double TerabitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toGigabytesPerSecond(x); + public static double TerabitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toTerabytesPerSecond(x); + public static double TerabitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.TerabitPerSecond.toPetabytesPerSecond(x); +} + +public static class PetabitPerSecondExtensions +{ + public static double PetabitPerSecondToBauds(this double x) => Units.DataTransferRate.PetabitPerSecond.toBauds(x); + public static double PetabitPerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toBitsPerSecond(x); + public static double PetabitPerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toKilobitsPerSecond(x); + public static double PetabitPerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toMegabitsPerSecond(x); + public static double PetabitPerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toGigabitsPerSecond(x); + public static double PetabitPerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toTerabitsPerSecond(x); + public static double PetabitPerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toBytesPerSecond(x); + public static double PetabitPerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toKilobytesPerSecond(x); + public static double PetabitPerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toMegabytesPerSecond(x); + public static double PetabitPerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toGigabytesPerSecond(x); + public static double PetabitPerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toTerabytesPerSecond(x); + public static double PetabitPerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.PetabitPerSecond.toPetabytesPerSecond(x); +} + +public static class BytePerSecondExtensions +{ + public static double BytePerSecondToBauds(this double x) => Units.DataTransferRate.BytePerSecond.toBauds(x); + public static double BytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toBitsPerSecond(x); + public static double BytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toKilobitsPerSecond(x); + public static double BytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toMegabitsPerSecond(x); + public static double BytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toGigabitsPerSecond(x); + public static double BytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toTerabitsPerSecond(x); + public static double BytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toPetabitsPerSecond(x); + public static double BytePerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toKilobytesPerSecond(x); + public static double BytePerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toMegabytesPerSecond(x); + public static double BytePerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toGigabytesPerSecond(x); + public static double BytePerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toTerabytesPerSecond(x); + public static double BytePerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.BytePerSecond.toPetabytesPerSecond(x); +} + +public static class KilobytePerSecondExtensions +{ + public static double KilobytePerSecondToBauds(this double x) => Units.DataTransferRate.KilobytePerSecond.toBauds(x); + public static double KilobytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toBitsPerSecond(x); + public static double KilobytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toKilobitsPerSecond(x); + public static double KilobytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toMegabitsPerSecond(x); + public static double KilobytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toGigabitsPerSecond(x); + public static double KilobytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toTerabitsPerSecond(x); + public static double KilobytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toPetabitsPerSecond(x); + public static double KilobytePerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toBytesPerSecond(x); + public static double KilobytePerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toMegabytesPerSecond(x); + public static double KilobytePerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toGigabytesPerSecond(x); + public static double KilobytePerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toTerabytesPerSecond(x); + public static double KilobytePerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.KilobytePerSecond.toPetabytesPerSecond(x); +} + +public static class MegabytePerSecondExtensions +{ + public static double MegabytePerSecondToBauds(this double x) => Units.DataTransferRate.MegabytePerSecond.toBauds(x); + public static double MegabytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toBitsPerSecond(x); + public static double MegabytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toKilobitsPerSecond(x); + public static double MegabytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toMegabitsPerSecond(x); + public static double MegabytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toGigabitsPerSecond(x); + public static double MegabytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toTerabitsPerSecond(x); + public static double MegabytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toPetabitsPerSecond(x); + public static double MegabytePerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toBytesPerSecond(x); + public static double MegabytePerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toKilobytesPerSecond(x); + public static double MegabytePerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toGigabytesPerSecond(x); + public static double MegabytePerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toTerabytesPerSecond(x); + public static double MegabytePerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.MegabytePerSecond.toPetabytesPerSecond(x); +} + +public static class GigabytePerSecondExtensions +{ + public static double GigabytePerSecondToBauds(this double x) => Units.DataTransferRate.GigabytePerSecond.toBauds(x); + public static double GigabytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toBitsPerSecond(x); + public static double GigabytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toKilobitsPerSecond(x); + public static double GigabytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toMegabitsPerSecond(x); + public static double GigabytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toGigabitsPerSecond(x); + public static double GigabytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toTerabitsPerSecond(x); + public static double GigabytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toPetabitsPerSecond(x); + public static double GigabytePerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toBytesPerSecond(x); + public static double GigabytePerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toKilobytesPerSecond(x); + public static double GigabytePerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toMegabytesPerSecond(x); + public static double GigabytePerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toTerabytesPerSecond(x); + public static double GigabytePerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.GigabytePerSecond.toPetabytesPerSecond(x); +} + +public static class TerabytePerSecondExtensions +{ + public static double TerabytePerSecondToBauds(this double x) => Units.DataTransferRate.TerabytePerSecond.toBauds(x); + public static double TerabytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toBitsPerSecond(x); + public static double TerabytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toKilobitsPerSecond(x); + public static double TerabytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toMegabitsPerSecond(x); + public static double TerabytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toGigabitsPerSecond(x); + public static double TerabytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toTerabitsPerSecond(x); + public static double TerabytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toPetabitsPerSecond(x); + public static double TerabytePerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toBytesPerSecond(x); + public static double TerabytePerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toKilobytesPerSecond(x); + public static double TerabytePerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toMegabytesPerSecond(x); + public static double TerabytePerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toGigabytesPerSecond(x); + public static double TerabytePerSecondToPetabytesPerSecond(this double x) => Units.DataTransferRate.TerabytePerSecond.toPetabytesPerSecond(x); +} + +public static class PetabytePerSecondExtensions +{ + public static double PetabytePerSecondToBauds(this double x) => Units.DataTransferRate.PetabytePerSecond.toBauds(x); + public static double PetabytePerSecondToBitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toBitsPerSecond(x); + public static double PetabytePerSecondToKilobitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toKilobitsPerSecond(x); + public static double PetabytePerSecondToMegabitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toMegabitsPerSecond(x); + public static double PetabytePerSecondToGigabitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toGigabitsPerSecond(x); + public static double PetabytePerSecondToTerabitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toTerabitsPerSecond(x); + public static double PetabytePerSecondToPetabitsPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toPetabitsPerSecond(x); + public static double PetabytePerSecondToBytesPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toBytesPerSecond(x); + public static double PetabytePerSecondToKilobytesPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toKilobytesPerSecond(x); + public static double PetabytePerSecondToMegabytesPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toMegabytesPerSecond(x); + public static double PetabytePerSecondToGigabytesPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toGigabytesPerSecond(x); + public static double PetabytePerSecondToTerabytesPerSecond(this double x) => Units.DataTransferRate.PetabytePerSecond.toTerabytesPerSecond(x); +} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Density.cs b/src/Fs.Units.CSharp/Compound/Density.cs similarity index 59% rename from Fs.Units.CSharp/Compound/Density.cs rename to src/Fs.Units.CSharp/Compound/Density.cs index 5592abc..ba8cb70 100644 --- a/Fs.Units.CSharp/Compound/Density.cs +++ b/src/Fs.Units.CSharp/Compound/Density.cs @@ -1,42 +1,42 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Density; +namespace Fs.Units.CSharp; public static class KilogramPerCubicMeterExtensions { public static double KilogramPerCubicMeterToGramsPerCubicCentimeter(this double x) => - KilogramPerCubicMeter.toGramsPerCubicCentimeter(x); + Units.Density.KilogramPerCubicMeter.toGramsPerCubicCentimeter(x); public static double KilogramPerCubicMeterToPoundMassPerCubicFoot(this double x) => - KilogramPerCubicMeter.toPoundMassPerCubicFoot(x); + Units.Density.KilogramPerCubicMeter.toPoundMassPerCubicFoot(x); public static double KilogramPerCubicMeterToPoundMassPerCubicInch(this double x) => - KilogramPerCubicMeter.toPoundMassPerCubicInch(x); + Units.Density.KilogramPerCubicMeter.toPoundMassPerCubicInch(x); } public static class GramPerCubicCentimeterExtensions { public static double GramPerCubicCentimeterToKilogramsPerCubicMeter(this double x) => - GramPerCubicCentimeter.toKilogramsPerCubicMeter(x); + Units.Density.GramPerCubicCentimeter.toKilogramsPerCubicMeter(x); public static double GramPerCubicCentimeterToPoundMassPerCubicFoot(this double x) => - GramPerCubicCentimeter.toPoundMassPerCubicFoot(x); + Units.Density.GramPerCubicCentimeter.toPoundMassPerCubicFoot(x); public static double GramPerCubicCentimeterToPoundMassPerCubicInch(this double x) => - GramPerCubicCentimeter.toPoundMassPerCubicInch(x); + Units.Density.GramPerCubicCentimeter.toPoundMassPerCubicInch(x); } public static class PoundMassPerCubicFootExtensions { public static double PoundMassPerCubicFootToKilogramsPerCubicMeter(this double x) => - PoundMassPerCubicFoot.toKilogramsPerCubicMeter(x); + Units.Density.PoundMassPerCubicFoot.toKilogramsPerCubicMeter(x); public static double PoundMassPerCubicFootToGramsPerCubicCentimeter(this double x) => - PoundMassPerCubicFoot.toGramsPerCubicCentimeter(x); + Units.Density.PoundMassPerCubicFoot.toGramsPerCubicCentimeter(x); public static double PoundMassPerCubicFootToPoundMassPerCubicInch(this double x) => - PoundMassPerCubicFoot.toPoundMassPerCubicInch(x); + Units.Density.PoundMassPerCubicFoot.toPoundMassPerCubicInch(x); } public static class PoundMassPerCubicInchExtensions { public static double PoundMassPerCubicInchToKilogramsPerCubicMeter(this double x) => - PoundMassPerCubicInch.toKilogramsPerCubicMeter(x); + Units.Density.PoundMassPerCubicInch.toKilogramsPerCubicMeter(x); public static double PoundMassPerCubicInchToGramsPerCubicCentimeter(this double x) => - PoundMassPerCubicInch.toGramsPerCubicCentimeter(x); + Units.Density.PoundMassPerCubicInch.toGramsPerCubicCentimeter(x); public static double PoundMassPerCubicInchToPoundMassPerCubicFoot(this double x) => - PoundMassPerCubicInch.toPoundMassPerCubicFoot(x); + Units.Density.PoundMassPerCubicInch.toPoundMassPerCubicFoot(x); } \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/ElectricCharge.cs b/src/Fs.Units.CSharp/Compound/ElectricCharge.cs similarity index 62% rename from Fs.Units.CSharp/Compound/ElectricCharge.cs rename to src/Fs.Units.CSharp/Compound/ElectricCharge.cs index 24d7d65..fe599d1 100644 --- a/Fs.Units.CSharp/Compound/ElectricCharge.cs +++ b/src/Fs.Units.CSharp/Compound/ElectricCharge.cs @@ -1,20 +1,20 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.ElectricCharge; +namespace Fs.Units.CSharp; public static class ColoumbExtensions { - public static double ColoumbToAmpereHours(this double x) => Coloumb.toAmpereHours(x); - public static double ColoumbToAmpereSeconds(this double x) => Coloumb.toAmpereSeconds(x); + public static double ColoumbToAmpereHours(this double x) => Units.ElectricCharge.Coulomb.toAmpereHours(x); + public static double ColoumbToAmpereSeconds(this double x) => Units.ElectricCharge.Coulomb.toAmpereSeconds(x); } public static class AmpereHourExtensions { - public static double AmpereHourToColoumbs(this double x) => AmpereHour.toColoumbs(x); - public static double AmpereHourToAmpereSeconds(this double x) => AmpereHour.toAmpereSeconds(x); + public static double AmpereHourToColoumbs(this double x) => Units.ElectricCharge.AmpereHour.toCoulombs(x); + public static double AmpereHourToAmpereSeconds(this double x) => Units.ElectricCharge.AmpereHour.toAmpereSeconds(x); } public static class AmpereSecondExtensions { - public static double AmpereSecondToColoumbs(this double x) => AmpereSecond.toColoumbs(x); - public static double AmpereSecondToAmpereHours(this double x) => AmpereSecond.toAmpereHours(x); + public static double AmpereSecondToColoumbs(this double x) => Units.ElectricCharge.AmpereSecond.toCoulombs(x); + public static double AmpereSecondToAmpereHours(this double x) => Units.ElectricCharge.AmpereSecond.toAmpereHours(x); } \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/ElectromotiveForce.cs b/src/Fs.Units.CSharp/Compound/ElectromotiveForce.cs new file mode 100644 index 0000000..d312b77 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/ElectromotiveForce.cs @@ -0,0 +1,42 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class MicrovoltExtensions +{ + public static double MicrovoltToMillivolts(this double x) => Units.ElectromotiveForce.Microvolt.toMillivolts(x); + public static double MicrovoltToVolts(this double x) => Units.ElectromotiveForce.Microvolt.toVolts(x); + public static double MicrovoltToKilovolts(this double x) => Units.ElectromotiveForce.Microvolt.toKilovolts(x); + public static double MicrovoltToMegavolts(this double x) => Units.ElectromotiveForce.Microvolt.toMegavolts(x); +} + +public static class MillivoltExtensions +{ + public static double MillivoltToMicrovolts(this double x) => Units.ElectromotiveForce.Millivolt.toMicrovolts(x); + public static double MillivoltToVolts(this double x) => Units.ElectromotiveForce.Millivolt.toVolts(x); + public static double MillivoltToKilovolts(this double x) => Units.ElectromotiveForce.Millivolt.toKilovolts(x); + public static double MillivoltToMegavolts(this double x) => Units.ElectromotiveForce.Millivolt.toMegavolts(x); +} + +public static class VoltExtensions +{ + public static double VoltToMicrovolts(this double x) => Units.ElectromotiveForce.Volt.toMicrovolts(x); + public static double VoltToMillivolts(this double x) => Units.ElectromotiveForce.Volt.toMillivolts(x); + public static double VoltToKilovolts(this double x) => Units.ElectromotiveForce.Volt.toKilovolts(x); + public static double VoltToMegavolts(this double x) => Units.ElectromotiveForce.Volt.toMegavolts(x); +} + +public static class KilovoltExtensions +{ + public static double KilovoltToMicrovolts(this double x) => Units.ElectromotiveForce.Kilovolt.toMicrovolts(x); + public static double KilovoltToMillivolts(this double x) => Units.ElectromotiveForce.Kilovolt.toMillivolts(x); + public static double KilovoltToVolts(this double x) => Units.ElectromotiveForce.Kilovolt.toVolts(x); + public static double KilovoltToMegavolts(this double x) => Units.ElectromotiveForce.Kilovolt.toMegavolts(x); +} + +public static class MegavoltExtensions +{ + public static double MegavoltToMicrovolts(this double x) => Units.ElectromotiveForce.Megavolt.toMicrovolts(x); + public static double MegavoltToMillivolts(this double x) => Units.ElectromotiveForce.Megavolt.toMillivolts(x); + public static double MegavoltToVolts(this double x) => Units.ElectromotiveForce.Megavolt.toVolts(x); + public static double MegavoltToKilovolts(this double x) => Units.ElectromotiveForce.Megavolt.toKilovolts(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/Energy.cs b/src/Fs.Units.CSharp/Compound/Energy.cs new file mode 100644 index 0000000..a24a2fc --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/Energy.cs @@ -0,0 +1,56 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class JouleExtensions +{ + public static double JouleToKilojoules(this double x) => Units.Energy.Joule.toKilojoules(x); + public static double JouleToBritishThermalUnits(this double x) => Units.Energy.Joule.toBritishThermalUnits(x); + public static double JouleToCalories(this double x) => Units.Energy.Joule.toCalories(x); + public static double JouleToQuads(this double x) => Units.Energy.Joule.toQuads(x); + public static double JouleToQs(this double x) => Units.Energy.Joule.toQs(x); +} + +public static class KilojouleExtensions +{ + public static double KilojouleToJoules(this double x) => Units.Energy.Kilojoule.toJoules(x); + public static double KilojouleToBritishThermalUnits(this double x) => Units.Energy.Kilojoule.toBritishThermalUnits(x); + public static double KilojouleToCalories(this double x) => Units.Energy.Kilojoule.toCalories(x); + public static double KilojouleToQuads(this double x) => Units.Energy.Kilojoule.toQuads(x); + public static double KilojouleToQs(this double x) => Units.Energy.Kilojoule.toQs(x); +} + +public static class BritishThermalUnitExtensions +{ + public static double BritishThermalUnitToJoules(this double x) => Units.Energy.BritishThermalUnit.toJoules(x); + public static double BritishThermalUnitToKilojoules(this double x) => Units.Energy.BritishThermalUnit.toKilojoules(x); + public static double BritishThermalUnitToCalories(this double x) => Units.Energy.BritishThermalUnit.toCalories(x); + public static double BritishThermalUnitToQuads(this double x) => Units.Energy.BritishThermalUnit.toQuads(x); + public static double BritishThermalUnitToQs(this double x) => Units.Energy.BritishThermalUnit.toQs(x); +} + +public static class CalorieExtensions +{ + public static double CalorieToJoules(this double x) => Units.Energy.Calorie.toJoules(x); + public static double CalorieToKilojoules(this double x) => Units.Energy.Calorie.toKilojoules(x); + public static double CalorieToBritishThermalUnits(this double x) => Units.Energy.Calorie.toBritishThermalUnits(x); + public static double CalorieToQuads(this double x) => Units.Energy.Calorie.toQuads(x); + public static double CalorieToQs(this double x) => Units.Energy.Calorie.toQs(x); +} + +public static class QuadExtensions +{ + public static double QuadToJoules(this double x) => Units.Energy.Quad.toJoules(x); + public static double QuadToKilojoules(this double x) => Units.Energy.Quad.toKilojoules(x); + public static double QuadToBritishThermalUnits(this double x) => Units.Energy.Quad.toBritishThermalUnits(x); + public static double QuadToCalories(this double x) => Units.Energy.Quad.toCalories(x); + public static double QuadToQs(this double x) => Units.Energy.Quad.toQs(x); +} + +public static class QExtensions +{ + public static double QToJoules(this double x) => Units.Energy.QModule.toJoules(x); + public static double QToKilojoules(this double x) => Units.Energy.QModule.toKilojoules(x); + public static double QToBritishThermalUnits(this double x) => Units.Energy.QModule.toBritishThermalUnits(x); + public static double QToCalories(this double x) => Units.Energy.QModule.toCalories(x); + public static double QToQuads(this double x) => Units.Energy.QModule.toQuads(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/Force.cs b/src/Fs.Units.CSharp/Compound/Force.cs new file mode 100644 index 0000000..d444fa1 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/Force.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class NewtonExtensions +{ + public static double NewtonToPoundForce(this double x) => Units.Force.Newton.toPoundForce(x); + public static double NewtonToDynes(this double x) => Units.Force.Newton.toDynes(x); + public static double NewtonToKips(this double x) => Units.Force.Newton.toKips(x); +} + +public static class PoundForceExtensions +{ + public static double PoundForceToNewtons(this double x) => Units.Force.PoundForce.toNewtons(x); + public static double PoundForceToDynes(this double x) => Units.Force.PoundForce.toDynes(x); + public static double PoundForceToKips(this double x) => Units.Force.PoundForce.toKips(x); +} + +public static class DyneExtensions +{ + public static double DyneToNewtons(this double x) => Units.Force.Dyne.toNewtons(x); + public static double DyneToPoundForce(this double x) => Units.Force.Dyne.toPoundForce(x); + public static double DyneToKips(this double x) => Units.Force.Dyne.toKips(x); +} + +public static class KipExtensions +{ + public static double KipToNewtons(this double x) => Units.Force.Kip.toNewtons(x); + public static double KipToPoundForce(this double x) => Units.Force.Kip.toPoundForce(x); + public static double KipToDynes(this double x) => Units.Force.Kip.toDynes(x); +} \ No newline at end of file diff --git a/Fs.Units.CSharp/Simple/FuelEconomy.cs b/src/Fs.Units.CSharp/Compound/FuelEconomy.cs similarity index 62% rename from Fs.Units.CSharp/Simple/FuelEconomy.cs rename to src/Fs.Units.CSharp/Compound/FuelEconomy.cs index 7d25d1a..b5b3666 100644 --- a/Fs.Units.CSharp/Simple/FuelEconomy.cs +++ b/src/Fs.Units.CSharp/Compound/FuelEconomy.cs @@ -1,12 +1,12 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.FuelEconomy; +namespace Fs.Units.CSharp; public static class MilePerGallonExtensions { - public static double MilePerGallonToKilometersPerLiter(this double x) => MilePerGallon.toKilometersPerLiter(x); + public static double MilePerGallonToKilometersPerLiter(this double x) => Units.FuelEconomy.MilePerGallon.toKilometersPerLiter(x); } public static class KilometerPerLiterExtensions { - public static double KilometerPerLiterToMilesPerGallon(this double x) => KilometerPerLiter.toMilesPerGallon(x); + public static double KilometerPerLiterToMilesPerGallon(this double x) => Units.FuelEconomy.KilometerPerLiter.toMilesPerGallon(x); } \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/Inductance.cs b/src/Fs.Units.CSharp/Compound/Inductance.cs new file mode 100644 index 0000000..3b44b81 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/Inductance.cs @@ -0,0 +1,20 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class MicroHenryExtensions +{ + public static double MicroHenryToMilliHenrys(this double x) => Units.Inductance.MicroHenry.toMilliHenrys(x); + public static double MicroHenryToHenrys(this double x) => Units.Inductance.MicroHenry.toHenrys(x); +} + +public static class MilliHenryExtensions +{ + public static double MilliHenryToMicroHenrys(this double x) => Units.Inductance.MilliHenry.toMicroHenrys(x); + public static double MilliHenryToHenrys(this double x) => Units.Inductance.MilliHenry.toHenrys(x); +} + +public static class HenryExtensions +{ + public static double HenryToMicroHenrys(this double x) => Units.Inductance.Henry.toMicroHenrys(x); + public static double HenryToMilliHenrys(this double x) => Units.Inductance.Henry.toMilliHenrys(x); +} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Inertia.cs b/src/Fs.Units.CSharp/Compound/Inertia.cs similarity index 63% rename from Fs.Units.CSharp/Compound/Inertia.cs rename to src/Fs.Units.CSharp/Compound/Inertia.cs index 63abbd9..0b26c61 100644 --- a/Fs.Units.CSharp/Compound/Inertia.cs +++ b/src/Fs.Units.CSharp/Compound/Inertia.cs @@ -1,12 +1,12 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Inertia; +namespace Fs.Units.CSharp; public static class QuarticInchExtensions { - public static double QuarticInchToQuarticCentimeters(this double x) => QuarticInch.toQuarticCentimeters(x); + public static double QuarticInchToQuarticCentimeters(this double x) => Units.Inertia.QuarticInch.toQuarticCentimeters(x); } public static class QuarticCentimeterExtensions { - public static double QuarticCentimeterToQuarticInches(this double x) => QuarticCentimeter.toQuarticInches(x); + public static double QuarticCentimeterToQuarticInches(this double x) => Units.Inertia.QuarticCentimeter.toQuarticInches(x); } \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/Power.cs b/src/Fs.Units.CSharp/Compound/Power.cs new file mode 100644 index 0000000..ac73631 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/Power.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class WattExtensions +{ + public static double WattToKilowatts(this double x) => Units.Power.Watt.toKilowatts(x); + public static double WattToHorsepower(this double x) => Units.Power.Watt.toHorsepower(x); + public static double WattToTonsOfRefrigeration(this double x) => Units.Power.Watt.toTonsOfRefrigeration(x); +} + +public static class KilowattExtensions +{ + public static double KilowattToWatts(this double x) => Units.Power.Kilowatt.toWatts(x); + public static double KilowattToHorsepower(this double x) => Units.Power.Kilowatt.toHorsepower(x); + public static double KilowattToTonsOfRefrigeration(this double x) => Units.Power.Kilowatt.toTonsOfRefrigeration(x); +} + +public static class HorsepowerExtensions +{ + public static double HorsepowerToWatts(this double x) => Units.Power.Horsepower.toWatts(x); + public static double HorsepowerToKilowatts(this double x) => Units.Power.Horsepower.toKilowatts(x); + public static double HorsepowerToTonsOfRefrigeration(this double x) => Units.Power.Horsepower.toTonsOfRefrigeration(x); +} + +public static class TonOfRefrigerationExtensions +{ + public static double TonOfRefrigerationToWatts(this double x) => Units.Power.TonOfRefrigeration.toWatts(x); + public static double TonOfRefrigerationToKilowatts(this double x) => Units.Power.TonOfRefrigeration.toKilowatts(x); + public static double TonOfRefrigerationToHorsepower(this double x) => Units.Power.TonOfRefrigeration.toHorsepower(x); +} \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Pressure.cs b/src/Fs.Units.CSharp/Compound/Pressure.cs similarity index 66% rename from Fs.Units.CSharp/Compound/Pressure.cs rename to src/Fs.Units.CSharp/Compound/Pressure.cs index 4b9077f..5b53f28 100644 --- a/Fs.Units.CSharp/Compound/Pressure.cs +++ b/src/Fs.Units.CSharp/Compound/Pressure.cs @@ -1,12 +1,12 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Pressure; +namespace Fs.Units.CSharp; public static class PascalExtensions { - public static double PascalToPoundsPerSquareInch(this double x) => Pascal.toPoundsPerSquareInch(x); + public static double PascalToPoundsPerSquareInch(this double x) => Units.Pressure.Pascal.toPoundsPerSquareInch(x); } public static class PoundPerSquareInchExtensions { - public static double PoundPerSquareInchToPascals(this double x) => PoundPerSquareInch.toPascals(x); + public static double PoundPerSquareInchToPascals(this double x) => Units.Pressure.PoundPerSquareInch.toPascals(x); } \ No newline at end of file diff --git a/Fs.Units.CSharp/Compound/Speed.cs b/src/Fs.Units.CSharp/Compound/Speed.cs similarity index 58% rename from Fs.Units.CSharp/Compound/Speed.cs rename to src/Fs.Units.CSharp/Compound/Speed.cs index 551539e..90b87a3 100644 --- a/Fs.Units.CSharp/Compound/Speed.cs +++ b/src/Fs.Units.CSharp/Compound/Speed.cs @@ -1,30 +1,30 @@ // ReSharper disable once CheckNamespace -namespace Fs.Units.CSharp.Speed; +namespace Fs.Units.CSharp; public static class FootPerSecondExtensions { - public static double FootPerSecondToMetersPerSecond(this double x) => FootPerSecond.toMetersPerSecond(x); - public static double FootPerSecondToKilometersPerHour(this double x) => FootPerSecond.toKilometersPerHour(x); - public static double FootPerSecondToMilesPerHour(this double x) => FootPerSecond.toMilesPerHour(x); + public static double FootPerSecondToMetersPerSecond(this double x) => Units.Speed.FootPerSecond.toMetersPerSecond(x); + public static double FootPerSecondToKilometersPerHour(this double x) => Units.Speed.FootPerSecond.toKilometersPerHour(x); + public static double FootPerSecondToMilesPerHour(this double x) => Units.Speed.FootPerSecond.toMilesPerHour(x); } public static class MeterPerSecondExtensions { - public static double MeterPerSecondToFootPerSecond(this double x) => MeterPerSecond.toFeetPerSecond(x); - public static double MeterPerSecondToKilometersPerHour(this double x) => MeterPerSecond.toKilometersPerHour(x); - public static double MeterPerSecondToMilesPerHour(this double x) => MeterPerSecond.toMilesPerHour(x); + public static double MeterPerSecondToFootPerSecond(this double x) => Units.Speed.MeterPerSecond.toFeetPerSecond(x); + public static double MeterPerSecondToKilometersPerHour(this double x) => Units.Speed.MeterPerSecond.toKilometersPerHour(x); + public static double MeterPerSecondToMilesPerHour(this double x) => Units.Speed.MeterPerSecond.toMilesPerHour(x); } public static class KilometerPerHourExtensions { - public static double KilometerPerHourToFootPerSecond(this double x) => KilometerPerHour.toFeetPerSecond(x); - public static double KilometerPerHourToMeterPerSecond(this double x) => KilometerPerHour.toMetersPerSecond(x); - public static double KilometerPerHourToMilesPerHour(this double x) => KilometerPerHour.toMilesPerHour(x); + public static double KilometerPerHourToFootPerSecond(this double x) => Units.Speed.KilometerPerHour.toFeetPerSecond(x); + public static double KilometerPerHourToMeterPerSecond(this double x) => Units.Speed.KilometerPerHour.toMetersPerSecond(x); + public static double KilometerPerHourToMilesPerHour(this double x) => Units.Speed.KilometerPerHour.toMilesPerHour(x); } public static class MilePerHourExtensions { - public static double MilePerHourToFootPerSecond(this double x) => MilePerHour.toFeetPerSecond(x); - public static double MilePerHourToMeterPerSecond(this double x) => MilePerHour.toMetersPerSecond(x); - public static double MilePerHourToKilometersPerHour(this double x) => MilePerHour.toKilometersPerHour(x); + public static double MilePerHourToFootPerSecond(this double x) => Units.Speed.MilePerHour.toFeetPerSecond(x); + public static double MilePerHourToMeterPerSecond(this double x) => Units.Speed.MilePerHour.toMetersPerSecond(x); + public static double MilePerHourToKilometersPerHour(this double x) => Units.Speed.MilePerHour.toKilometersPerHour(x); } \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Compound/Volume.cs b/src/Fs.Units.CSharp/Compound/Volume.cs new file mode 100644 index 0000000..2caab02 --- /dev/null +++ b/src/Fs.Units.CSharp/Compound/Volume.cs @@ -0,0 +1,56 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class CubicInchExtensions +{ + public static double CubicInchToCubicFeet(this double x) => Units.Volume.CubicInch.toCubicFeet(x); + public static double CubicInchToCubicCentimeters(this double x) => Units.Volume.CubicInch.toCubicCentimeters(x); + public static double CubicInchToCubicMeters(this double x) => Units.Volume.CubicInch.toCubicMeters(x); + public static double CubicInchToLiters(this double x) => Units.Volume.CubicInch.toLiters(x); + public static double CubicInchToGallons(this double x) => Units.Volume.CubicInch.toGallons(x); +} + +public static class CubicFootExtensions +{ + public static double CubicFootToCubicInches(this double x) => Units.Volume.CubicFoot.toCubicInches(x); + public static double CubicFootToCubicCentimeters(this double x) => Units.Volume.CubicFoot.toCubicCentimeters(x); + public static double CubicFootToCubicMeters(this double x) => Units.Volume.CubicFoot.toCubicMeters(x); + public static double CubicFootToLiters(this double x) => Units.Volume.CubicFoot.toLiters(x); + public static double CubicFootToGallons(this double x) => Units.Volume.CubicFoot.toGallons(x); +} + +public static class CubicCentimeterExtensions +{ + public static double CubicCentimeterToCubicInches(this double x) => Units.Volume.CubicCentimeter.toCubicInches(x); + public static double CubicCentimeterToCubicFeet(this double x) => Units.Volume.CubicCentimeter.toCubicFeet(x); + public static double CubicCentimeterToCubicMeters(this double x) => Units.Volume.CubicCentimeter.toCubicMeters(x); + public static double CubicCentimeterToLiters(this double x) => Units.Volume.CubicCentimeter.toLiters(x); + public static double CubicCentimeterToGallons(this double x) => Units.Volume.CubicCentimeter.toGallons(x); +} + +public static class CubicMeterExtensions +{ + public static double CubicMeterToCubicInches(this double x) => Units.Volume.CubicMeter.toCubicInches(x); + public static double CubicMeterToCubicFeet(this double x) => Units.Volume.CubicMeter.toCubicFeet(x); + public static double CubicMeterToCubicCentimeters(this double x) => Units.Volume.CubicMeter.toCubicCentimeters(x); + public static double CubicMeterToLiters(this double x) => Units.Volume.CubicMeter.toLiters(x); + public static double CubicMeterToGallons(this double x) => Units.Volume.CubicMeter.toGallons(x); +} + +public static class LiterExtensions +{ + public static double LiterToCubicInches(this double x) => Units.Volume.Liter.toCubicInches(x); + public static double LiterToCubicFeet(this double x) => Units.Volume.Liter.toCubicFeet(x); + public static double LiterToCubicCentimeters(this double x) => Units.Volume.Liter.toCubicCentimeters(x); + public static double LiterToCubicMeters(this double x) => Units.Volume.Liter.toCubicMeters(x); + public static double LiterToGallons(this double x) => Units.Volume.Liter.toGallons(x); +} + +public static class GallonExtensions +{ + public static double GallonToCubicInches(this double x) => Units.Volume.Gallon.toCubicInches(x); + public static double GallonToCubicFeet(this double x) => Units.Volume.Gallon.toCubicFeet(x); + public static double GallonToCubicCentimeters(this double x) => Units.Volume.Gallon.toCubicCentimeters(x); + public static double GallonToCubicMeters(this double x) => Units.Volume.Gallon.toCubicMeters(x); + public static double GallonToLiters(this double x) => Units.Volume.Gallon.toLiters(x); +} \ No newline at end of file diff --git a/Fs.Units.CSharp/Fs.Units.CSharp.csproj b/src/Fs.Units.CSharp/Fs.Units.CSharp.csproj similarity index 74% rename from Fs.Units.CSharp/Fs.Units.CSharp.csproj rename to src/Fs.Units.CSharp/Fs.Units.CSharp.csproj index 77d43c5..c674611 100644 --- a/Fs.Units.CSharp/Fs.Units.CSharp.csproj +++ b/src/Fs.Units.CSharp/Fs.Units.CSharp.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + netstandard2.0 enable latest true @@ -19,15 +19,19 @@ - - True - \ - + - + + True + \ + + + True + \ + - - + + diff --git a/src/Fs.Units.CSharp/Simple/Angle.cs b/src/Fs.Units.CSharp/Simple/Angle.cs new file mode 100644 index 0000000..4cc17a8 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Angle.cs @@ -0,0 +1,56 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class DegreeExtensions +{ + public static double DegreeToRadians(this double x) => Units.Angle.Degree.toRadians(x); + public static double DegreeToGradians(this double x) => Units.Angle.Degree.toGradians(x); + public static double DegreeToRevolutions(this double x) => Units.Angle.Degree.toRevolutions(x); + public static double DegreeToArcMinutes(this double x) => Units.Angle.Degree.toArcMinutes(x); + public static double DegreeToArcSeconds(this double x) => Units.Angle.Degree.toArcSeconds(x); +} + +public static class RadianExtensions +{ + public static double RadianToDegrees(this double x) => Units.Angle.Radian.toDegrees(x); + public static double RadianToGradians(this double x) => Units.Angle.Radian.toGradians(x); + public static double RadianToRevolutions(this double x) => Units.Angle.Radian.toRevolutions(x); + public static double RadianToArcMinutes(this double x) => Units.Angle.Radian.toArcMinutes(x); + public static double RadianToArcSeconds(this double x) => Units.Angle.Radian.toArcSeconds(x); +} + +public static class GradianExtensions +{ + public static double GradianToDegrees(this double x) => Units.Angle.Gradian.toDegrees(x); + public static double GradianToRadians(this double x) => Units.Angle.Gradian.toRadians(x); + public static double GradianToRevolutions(this double x) => Units.Angle.Gradian.toRevolutions(x); + public static double GradianToArcMinutes(this double x) => Units.Angle.Gradian.toArcMinutes(x); + public static double GradianToArcSeconds(this double x) => Units.Angle.Gradian.toArcSeconds(x); +} + +public static class RevolutionExtensions +{ + public static double RevolutionToDegrees(this double x) => Units.Angle.Revolution.toDegrees(x); + public static double RevolutionToRadians(this double x) => Units.Angle.Revolution.toRadians(x); + public static double RevolutionToGradians(this double x) => Units.Angle.Revolution.toGradians(x); + public static double RevolutionToArcMinutes(this double x) => Units.Angle.Revolution.toArcMinutes(x); + public static double RevolutionToArcSeconds(this double x) => Units.Angle.Revolution.toArcSeconds(x); +} + +public static class ArcMinuteExtensions +{ + public static double ArcMinuteToDegrees(this double x) => Units.Angle.ArcMinute.toDegrees(x); + public static double ArcMinuteToRadians(this double x) => Units.Angle.ArcMinute.toRadians(x); + public static double ArcMinuteToGradians(this double x) => Units.Angle.ArcMinute.toGradians(x); + public static double ArcMinuteToRevolutions(this double x) => Units.Angle.ArcMinute.toRevolutions(x); + public static double ArcMinuteToArcSeconds(this double x) => Units.Angle.ArcMinute.toArcSeconds(x); +} + +public static class ArcSecondExtensions +{ + public static double ArcSecondToDegrees(this double x) => Units.Angle.ArcSecond.toDegrees(x); + public static double ArcSecondToRadians(this double x) => Units.Angle.ArcSecond.toRadians(x); + public static double ArcSecondToGradians(this double x) => Units.Angle.ArcSecond.toGradians(x); + public static double ArcSecondToRevolutions(this double x) => Units.Angle.ArcSecond.toRevolutions(x); + public static double ArcSecondToArcMinutes(this double x) => Units.Angle.ArcSecond.toArcMinutes(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Current.cs b/src/Fs.Units.CSharp/Simple/Current.cs new file mode 100644 index 0000000..8f73735 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Current.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class MicroampereExtensions +{ + public static double MicroampereToAmperes(this double x) => Units.Current.Microampere.toAmperes(x); + public static double MicroampereToMilliamperes(this double x) => Units.Current.Microampere.toMilliamperes(x); + public static double MicroampereToBiots(this double x) => Units.Current.Microampere.toBiots(x); +} + +public static class MilliampereExtensions +{ + public static double MilliampereToAmperes(this double x) => Units.Current.Milliampere.toAmperes(x); + public static double MilliampereToMicroamperes(this double x) => Units.Current.Milliampere.toMicroamperes(x); + public static double MilliampereToBiots(this double x) => Units.Current.Milliampere.toBiots(x); +} + +public static class AmpereExtensions +{ + public static double AmpereToMilliamperes(this double x) => Units.Current.Ampere.toMilliamperes(x); + public static double AmpereToMicroamperes(this double x) => Units.Current.Ampere.toMicroamperes(x); + public static double AmpereToBiots(this double x) => Units.Current.Ampere.toBiots(x); +} + +public static class BiotExtensions +{ + public static double BiotToAmperes(this double x) => Units.Current.Biot.toAmperes(x); + public static double BiotToMilliamperes(this double x) => Units.Current.Biot.toMilliamperes(x); + public static double BiotToMicroamperes(this double x) => Units.Current.Biot.toMicroamperes(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/DataStorage.cs b/src/Fs.Units.CSharp/Simple/DataStorage.cs new file mode 100644 index 0000000..db57320 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/DataStorage.cs @@ -0,0 +1,183 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class BitExtensions +{ + public static double BitToKilobits(this double x) => Units.DataStorage.Bit.toKilobits(x); + public static double BitToMegabits(this double x) => Units.DataStorage.Bit.toMegabits(x); + public static double BitToGigabits(this double x) => Units.DataStorage.Bit.toGigabits(x); + public static double BitToTerabits(this double x) => Units.DataStorage.Bit.toTerabits(x); + public static double BitToPetabits(this double x) => Units.DataStorage.Bit.toPetabits(x); + public static double BitToBytes(this double x) => Units.DataStorage.Bit.toBytes(x); + public static double BitToKilobytes(this double x) => Units.DataStorage.Bit.toKilobytes(x); + public static double BitToMegabytes(this double x) => Units.DataStorage.Bit.toMegabytes(x); + public static double BitToGigabytes(this double x) => Units.DataStorage.Bit.toGigabytes(x); + public static double BitToTerabytes(this double x) => Units.DataStorage.Bit.toTerabytes(x); + public static double BitToPetabytes(this double x) => Units.DataStorage.Bit.toPetabytes(x); +} + +public static class KilobitExtensions +{ + public static double KilobitsToBits(this double x) => Units.DataStorage.Kilobit.toBits(x); + public static double KilobitsToMegabits(this double x) => Units.DataStorage.Kilobit.toMegabits(x); + public static double KilobitsToGigabits(this double x) => Units.DataStorage.Kilobit.toGigabits(x); + public static double KilobitsToTerabits(this double x) => Units.DataStorage.Kilobit.toTerabits(x); + public static double KilobitsToPetabits(this double x) => Units.DataStorage.Kilobit.toPetabits(x); + public static double KilobitsToBytes(this double x) => Units.DataStorage.Kilobit.toBytes(x); + public static double KilobitsToKilobytes(this double x) => Units.DataStorage.Kilobit.toKilobytes(x); + public static double KilobitsToMegabytes(this double x) => Units.DataStorage.Kilobit.toMegabytes(x); + public static double KilobitsToGigabytes(this double x) => Units.DataStorage.Kilobit.toGigabytes(x); + public static double KilobitsToTerabytes(this double x) => Units.DataStorage.Kilobit.toTerabytes(x); + public static double KilobitsToPetabytes(this double x) => Units.DataStorage.Kilobit.toPetabytes(x); +} + +public static class MegabitExtensions +{ + public static double MegabitsToBits(this double x) => Units.DataStorage.Megabit.toBits(x); + public static double MegabitsToKilobits(this double x) => Units.DataStorage.Megabit.toKilobits(x); + public static double MegabitsToGigabits(this double x) => Units.DataStorage.Megabit.toGigabits(x); + public static double MegabitsToTerabits(this double x) => Units.DataStorage.Megabit.toTerabits(x); + public static double MegabitsToPetabits(this double x) => Units.DataStorage.Megabit.toPetabits(x); + public static double MegabitsToBytes(this double x) => Units.DataStorage.Megabit.toBytes(x); + public static double MegabitsToKilobytes(this double x) => Units.DataStorage.Megabit.toKilobytes(x); + public static double MegabitsToMegabytes(this double x) => Units.DataStorage.Megabit.toMegabytes(x); + public static double MegabitsToGigabytes(this double x) => Units.DataStorage.Megabit.toGigabytes(x); + public static double MegabitsToTerabytes(this double x) => Units.DataStorage.Megabit.toTerabytes(x); + public static double MegabitsToPetabytes(this double x) => Units.DataStorage.Megabit.toPetabytes(x); +} + +public static class GigabitExtensions +{ + public static double GigabitsToBits(this double x) => Units.DataStorage.Gigabit.toBits(x); + public static double GigabitsToKilobits(this double x) => Units.DataStorage.Gigabit.toKilobits(x); + public static double GigabitsToMegabits(this double x) => Units.DataStorage.Gigabit.toMegabits(x); + public static double GigabitsToTerabits(this double x) => Units.DataStorage.Gigabit.toTerabits(x); + public static double GigabitsToPetabits(this double x) => Units.DataStorage.Gigabit.toPetabits(x); + public static double GigabitsToBytes(this double x) => Units.DataStorage.Gigabit.toBytes(x); + public static double GigabitsToKilobytes(this double x) => Units.DataStorage.Gigabit.toKilobytes(x); + public static double GigabitsToMegabytes(this double x) => Units.DataStorage.Gigabit.toMegabytes(x); + public static double GigabitsToGigabytes(this double x) => Units.DataStorage.Gigabit.toGigabytes(x); + public static double GigabitsToTerabytes(this double x) => Units.DataStorage.Gigabit.toTerabytes(x); + public static double GigabitsToPetabytes(this double x) => Units.DataStorage.Gigabit.toPetabytes(x); +} + +public static class TerabitExtensions +{ + public static double TerabitsToBits(this double x) => Units.DataStorage.Terabit.toBits(x); + public static double TerabitsToKilobits(this double x) => Units.DataStorage.Terabit.toKilobits(x); + public static double TerabitsToMegabits(this double x) => Units.DataStorage.Terabit.toMegabits(x); + public static double TerabitsToGigabits(this double x) => Units.DataStorage.Terabit.toGigabits(x); + public static double TerabitsToPetabits(this double x) => Units.DataStorage.Terabit.toPetabits(x); + public static double TerabitsToBytes(this double x) => Units.DataStorage.Terabit.toBytes(x); + public static double TerabitsToKilobytes(this double x) => Units.DataStorage.Terabit.toKilobytes(x); + public static double TerabitsToMegabytes(this double x) => Units.DataStorage.Terabit.toMegabytes(x); + public static double TerabitsToGigabytes(this double x) => Units.DataStorage.Terabit.toGigabytes(x); + public static double TerabitsToTerabytes(this double x) => Units.DataStorage.Terabit.toTerabytes(x); + public static double TerabitsToPetabytes(this double x) => Units.DataStorage.Terabit.toPetabytes(x); +} + +public static class PetabitExtensions +{ + public static double PetabitsToBits(this double x) => Units.DataStorage.Petabit.toBits(x); + public static double PetabitsToKilobits(this double x) => Units.DataStorage.Petabit.toKilobits(x); + public static double PetabitsToMegabits(this double x) => Units.DataStorage.Petabit.toMegabits(x); + public static double PetabitsToGigabits(this double x) => Units.DataStorage.Petabit.toGigabits(x); + public static double PetabitsToTerabits(this double x) => Units.DataStorage.Petabit.toTerabits(x); + public static double PetabitsToBytes(this double x) => Units.DataStorage.Petabit.toBytes(x); + public static double PetabitsToKilobytes(this double x) => Units.DataStorage.Petabit.toKilobytes(x); + public static double PetabitsToMegabytes(this double x) => Units.DataStorage.Petabit.toMegabytes(x); + public static double PetabitsToGigabytes(this double x) => Units.DataStorage.Petabit.toGigabytes(x); + public static double PetabitsToTerabytes(this double x) => Units.DataStorage.Petabit.toTerabytes(x); + public static double PetabitsToPetabytes(this double x) => Units.DataStorage.Petabit.toPetabytes(x); +} + +public static class ByteExtensions +{ + public static double BytesToBits(this double x) => Units.DataStorage.Byte.toBits(x); + public static double BytesToKilobits(this double x) => Units.DataStorage.Byte.toKilobits(x); + public static double BytesToMegabits(this double x) => Units.DataStorage.Byte.toMegabits(x); + public static double BytesToGigabits(this double x) => Units.DataStorage.Byte.toGigabits(x); + public static double BytesToTerabits(this double x) => Units.DataStorage.Byte.toTerabits(x); + public static double BytesToPetabits(this double x) => Units.DataStorage.Byte.toPetabits(x); + public static double BytesToKilobytes(this double x) => Units.DataStorage.Byte.toKilobytes(x); + public static double BytesToMegabytes(this double x) => Units.DataStorage.Byte.toMegabytes(x); + public static double BytesToGigabytes(this double x) => Units.DataStorage.Byte.toGigabytes(x); + public static double BytesToTerabytes(this double x) => Units.DataStorage.Byte.toTerabytes(x); + public static double BytesToPetabytes(this double x) => Units.DataStorage.Byte.toPetabytes(x); +} + +public static class KilobyteExtensions +{ + public static double KilobytesToBits(this double x) => Units.DataStorage.Kilobyte.toBits(x); + public static double KilobytesToKilobits(this double x) => Units.DataStorage.Kilobyte.toKilobits(x); + public static double KilobytesToMegabits(this double x) => Units.DataStorage.Kilobyte.toMegabits(x); + public static double KilobytesToGigabits(this double x) => Units.DataStorage.Kilobyte.toGigabits(x); + public static double KilobytesToTerabits(this double x) => Units.DataStorage.Kilobyte.toTerabits(x); + public static double KilobytesToPetabits(this double x) => Units.DataStorage.Kilobyte.toPetabits(x); + public static double KilobytesToBytes(this double x) => Units.DataStorage.Kilobyte.toBytes(x); + public static double KilobytesToMegabytes(this double x) => Units.DataStorage.Kilobyte.toMegabytes(x); + public static double KilobytesToGigabytes(this double x) => Units.DataStorage.Kilobyte.toGigabytes(x); + public static double KilobytesToTerabytes(this double x) => Units.DataStorage.Kilobyte.toTerabytes(x); + public static double KilobytesToPetabytes(this double x) => Units.DataStorage.Kilobyte.toPetabytes(x); +} + +public static class MegabyteExtensions +{ + public static double MegabytesToBits(this double x) => Units.DataStorage.Megabyte.toBits(x); + public static double MegabytesToKilobits(this double x) => Units.DataStorage.Megabyte.toKilobits(x); + public static double MegabytesToMegabits(this double x) => Units.DataStorage.Megabyte.toMegabits(x); + public static double MegabytesToGigabits(this double x) => Units.DataStorage.Megabyte.toGigabits(x); + public static double MegabytesToTerabits(this double x) => Units.DataStorage.Megabyte.toTerabits(x); + public static double MegabytesToPetabits(this double x) => Units.DataStorage.Megabyte.toPetabits(x); + public static double MegabytesToBytes(this double x) => Units.DataStorage.Megabyte.toBytes(x); + public static double MegabytesToKilobytes(this double x) => Units.DataStorage.Megabyte.toKilobytes(x); + public static double MegabytesToGigabytes(this double x) => Units.DataStorage.Megabyte.toGigabytes(x); + public static double MegabytesToTerabytes(this double x) => Units.DataStorage.Megabyte.toTerabytes(x); + public static double MegabytesToPetabytes(this double x) => Units.DataStorage.Megabyte.toPetabytes(x); +} + +public static class GigabyteExtensions +{ + public static double GigabytesToBits(this double x) => Units.DataStorage.Gigabyte.toBits(x); + public static double GigabytesToKilobits(this double x) => Units.DataStorage.Gigabyte.toKilobits(x); + public static double GigabytesToMegabits(this double x) => Units.DataStorage.Gigabyte.toMegabits(x); + public static double GigabytesToGigabits(this double x) => Units.DataStorage.Gigabyte.toGigabits(x); + public static double GigabytesToTerabits(this double x) => Units.DataStorage.Gigabyte.toTerabits(x); + public static double GigabytesToPetabits(this double x) => Units.DataStorage.Gigabyte.toPetabits(x); + public static double GigabytesToBytes(this double x) => Units.DataStorage.Gigabyte.toBytes(x); + public static double GigabytesToKilobytes(this double x) => Units.DataStorage.Gigabyte.toKilobytes(x); + public static double GigabytesToMegabytes(this double x) => Units.DataStorage.Gigabyte.toMegabytes(x); + public static double GigabytesToTerabytes(this double x) => Units.DataStorage.Gigabyte.toTerabytes(x); + public static double GigabytesToPetabytes(this double x) => Units.DataStorage.Gigabyte.toPetabytes(x); +} + +public static class TerabyteExtensions +{ + public static double TerabytesToBits(this double x) => Units.DataStorage.Terabyte.toBits(x); + public static double TerabytesToKilobits(this double x) => Units.DataStorage.Terabyte.toKilobits(x); + public static double TerabytesToMegabits(this double x) => Units.DataStorage.Terabyte.toMegabits(x); + public static double TerabytesToGigabits(this double x) => Units.DataStorage.Terabyte.toGigabits(x); + public static double TerabytesToTerabits(this double x) => Units.DataStorage.Terabyte.toTerabits(x); + public static double TerabytesToPetabits(this double x) => Units.DataStorage.Terabyte.toPetabits(x); + public static double TerabytesToBytes(this double x) => Units.DataStorage.Terabyte.toBytes(x); + public static double TerabytesToKilobytes(this double x) => Units.DataStorage.Terabyte.toKilobytes(x); + public static double TerabytesToMegabytes(this double x) => Units.DataStorage.Terabyte.toMegabytes(x); + public static double TerabytesToGigabytes(this double x) => Units.DataStorage.Terabyte.toGigabytes(x); + public static double TerabytesToPetabytes(this double x) => Units.DataStorage.Terabyte.toPetabytes(x); +} + +public static class PetabyteExtensions +{ + public static double PetabytesToBits(this double x) => Units.DataStorage.Petabyte.toBits(x); + public static double PetabytesToKilobits(this double x) => Units.DataStorage.Petabyte.toKilobits(x); + public static double PetabytesToMegabits(this double x) => Units.DataStorage.Petabyte.toMegabits(x); + public static double PetabytesToGigabits(this double x) => Units.DataStorage.Petabyte.toGigabits(x); + public static double PetabytesToTerabits(this double x) => Units.DataStorage.Petabyte.toTerabits(x); + public static double PetabytesToPetabits(this double x) => Units.DataStorage.Petabyte.toPetabits(x); + public static double PetabytesToBytes(this double x) => Units.DataStorage.Petabyte.toBytes(x); + public static double PetabytesToKilobytes(this double x) => Units.DataStorage.Petabyte.toKilobytes(x); + public static double PetabytesToMegabytes(this double x) => Units.DataStorage.Petabyte.toMegabytes(x); + public static double PetabytesToGigabytes(this double x) => Units.DataStorage.Petabyte.toGigabytes(x); + public static double PetabytesToTerabytes(this double x) => Units.DataStorage.Petabyte.toTerabytes(x); +} + diff --git a/src/Fs.Units.CSharp/Simple/Frequency.cs b/src/Fs.Units.CSharp/Simple/Frequency.cs new file mode 100644 index 0000000..b0116c3 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Frequency.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class HertzExtensions +{ + public static double HertzToKilohertz(this double x) => Units.Frequency.Hertz.toKilohertz(x); + public static double HertzToMegahertz(this double x) => Units.Frequency.Hertz.toMegahertz(x); + public static double HertzToGigahertz(this double x) => Units.Frequency.Hertz.toGigahertz(x); +} + +public static class KilohertzExtensions +{ + public static double KilohertzToHertz(this double x) => Units.Frequency.Kilohertz.toHertz(x); + public static double KilohertzToMegahertz(this double x) => Units.Frequency.Kilohertz.toMegahertz(x); + public static double KilohertzToGigahertz(this double x) => Units.Frequency.Kilohertz.toGigahertz(x); +} + +public static class MegahertzExtensions +{ + public static double MegahertzToHertz(this double x) => Units.Frequency.Megahertz.toHertz(x); + public static double MegahertzToKilohertz(this double x) => Units.Frequency.Megahertz.toKilohertz(x); + public static double MegahertzToGigahertz(this double x) => Units.Frequency.Megahertz.toGigahertz(x); +} + +public static class GigahertzExtensions +{ + public static double GigahertzToHertz(this double x) => Units.Frequency.Gigahertz.toHertz(x); + public static double GigahertzToKilohertz(this double x) => Units.Frequency.Gigahertz.toKilohertz(x); + public static double GigahertzToMegahertz(this double x) => Units.Frequency.Gigahertz.toMegahertz(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Illuminance.cs b/src/Fs.Units.CSharp/Simple/Illuminance.cs new file mode 100644 index 0000000..1479a6d --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Illuminance.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class FootcandleExtensions +{ + public static double FootcandleToLux(this double x) => Units.Illuminance.Footcandle.toLux(x); + public static double FootcandleToPhot(this double x) => Units.Illuminance.Footcandle.toPhot(x); + public static double FootcandleToNox(this double x) => Units.Illuminance.Footcandle.toNox(x); +} + +public static class LuxExtensions +{ + public static double LuxToFootcandle(this double x) => Units.Illuminance.Lux.toFootcandle(x); + public static double LuxToPhot(this double x) => Units.Illuminance.Lux.toPhot(x); + public static double LuxToNox(this double x) => Units.Illuminance.Lux.toNox(x); +} + +public static class PhotExtensions +{ + public static double PhotToFootcandle(this double x) => Units.Illuminance.Phot.toFootcandle(x); + public static double PhotToLux(this double x) => Units.Illuminance.Phot.toLux(x); + public static double PhotToNox(this double x) => Units.Illuminance.Phot.toNox(x); +} + +public static class NoxExtensions +{ + public static double NoxToFootcandle(this double x) => Units.Illuminance.Nox.toFootcandle(x); + public static double NoxToLux(this double x) => Units.Illuminance.Nox.toLux(x); + public static double NoxToPhot(this double x) => Units.Illuminance.Nox.toPhot(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Length.cs b/src/Fs.Units.CSharp/Simple/Length.cs new file mode 100644 index 0000000..201eb2c --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Length.cs @@ -0,0 +1,254 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class InchExtensions +{ + public static double InchToFeet(this double x) => Units.Length.Inch.toFeet(x); + public static double InchToYards(this double x) => Units.Length.Inch.toYards(x); + public static double InchToMiles(this double x) => Units.Length.Inch.toMiles(x); + public static double InchToMillimeters(this double x) => Units.Length.Inch.toMillimeters(x); + public static double InchToCentimeters(this double x) => Units.Length.Inch.toCentimeters(x); + public static double InchToDecimeters(this double x) => Units.Length.Inch.toDecimeters(x); + public static double InchToMeters(this double x) => Units.Length.Inch.toMeters(x); + public static double InchToKilometers(this double x) => Units.Length.Inch.toKilometers(x); + public static double InchToNauticalMiles(this double x) => Units.Length.Inch.toNauticalMiles(x); + public static double InchToChains(this double x) => Units.Length.Inch.toChains(x); + public static double InchToFurlongs(this double x) => Units.Length.Inch.toFurlongs(x); + public static double InchToLeagues(this double x) => Units.Length.Inch.toLeagues(x); + public static double InchToHands(this double x) => Units.Length.Inch.toHands(x); + public static double InchToRods(this double x) => Units.Length.Inch.toRods(x); +} + +public static class FootExtensions +{ + public static double FootToInches(this double x) => Units.Length.Foot.toInches(x); + public static double FootToYards(this double x) => Units.Length.Foot.toYards(x); + public static double FootToMiles(this double x) => Units.Length.Foot.toMiles(x); + public static double FootToMillimeters(this double x) => Units.Length.Foot.toMillimeters(x); + public static double FootToCentimeters(this double x) => Units.Length.Foot.toCentimeters(x); + public static double FootToDecimeters(this double x) => Units.Length.Foot.toDecimeters(x); + public static double FootToMeters(this double x) => Units.Length.Foot.toMeters(x); + public static double FootToKilometers(this double x) => Units.Length.Foot.toKilometers(x); + public static double FootToNauticalMiles(this double x) => Units.Length.Foot.toNauticalMiles(x); + public static double FootToChains(this double x) => Units.Length.Foot.toChains(x); + public static double FootToFurlongs(this double x) => Units.Length.Foot.toFurlongs(x); + public static double FootToLeagues(this double x) => Units.Length.Foot.toLeagues(x); + public static double FootToHands(this double x) => Units.Length.Foot.toHands(x); + public static double FootToRods(this double x) => Units.Length.Foot.toRods(x); +} + +public static class YardExtensions +{ + public static double YardToInches(this double x) => Units.Length.Yard.toInches(x); + public static double YardToFeet(this double x) => Units.Length.Yard.toFeet(x); + public static double YardToMiles(this double x) => Units.Length.Yard.toMiles(x); + public static double YardToMillimeters(this double x) => Units.Length.Yard.toMillimeters(x); + public static double YardToCentimeters(this double x) => Units.Length.Yard.toCentimeters(x); + public static double YardToDecimeters(this double x) => Units.Length.Yard.toDecimeters(x); + public static double YardToMeters(this double x) => Units.Length.Yard.toMeters(x); + public static double YardToKilometers(this double x) => Units.Length.Yard.toKilometers(x); + public static double YardToNauticalMiles(this double x) => Units.Length.Yard.toNauticalMiles(x); + public static double YardToChains(this double x) => Units.Length.Yard.toChains(x); + public static double YardToFurlongs(this double x) => Units.Length.Yard.toFurlongs(x); + public static double YardToLeagues(this double x) => Units.Length.Yard.toLeagues(x); + public static double YardToHands(this double x) => Units.Length.Yard.toHands(x); + public static double YardToRods(this double x) => Units.Length.Yard.toRods(x); +} + +public static class MileExtensions +{ + public static double MileToInches(this double x) => Units.Length.Mile.toInches(x); + public static double MileToFeet(this double x) => Units.Length.Mile.toFeet(x); + public static double MileToYards(this double x) => Units.Length.Mile.toYards(x); + public static double MileToMillimeters(this double x) => Units.Length.Mile.toMillimeters(x); + public static double MileToCentimeters(this double x) => Units.Length.Mile.toCentimeters(x); + public static double MileToDecimeters(this double x) => Units.Length.Mile.toDecimeters(x); + public static double MileToMeters(this double x) => Units.Length.Mile.toMeters(x); + public static double MileToKilometers(this double x) => Units.Length.Mile.toKilometers(x); + public static double MileToNauticalMiles(this double x) => Units.Length.Mile.toNauticalMiles(x); + public static double MileToChains(this double x) => Units.Length.Mile.toChains(x); + public static double MileToFurlongs(this double x) => Units.Length.Mile.toFurlongs(x); + public static double MileToLeagues(this double x) => Units.Length.Mile.toLeagues(x); + public static double MileToHands(this double x) => Units.Length.Mile.toHands(x); + public static double MileToRods(this double x) => Units.Length.Mile.toRods(x); +} + +public static class MillimeterExtensions +{ + public static double MillimeterToInches(this double x) => Units.Length.Millimeter.toInches(x); + public static double MillimeterToFeet(this double x) => Units.Length.Millimeter.toFeet(x); + public static double MillimeterToYards(this double x) => Units.Length.Millimeter.toYards(x); + public static double MillimeterToMiles(this double x) => Units.Length.Millimeter.toMiles(x); + public static double MillimeterToCentimeters(this double x) => Units.Length.Millimeter.toCentimeters(x); + public static double MillimeterToDecimeters(this double x) => Units.Length.Millimeter.toDecimeters(x); + public static double MillimeterToMeters(this double x) => Units.Length.Millimeter.toMeters(x); + public static double MillimeterToKilometers(this double x) => Units.Length.Millimeter.toKilometers(x); + public static double MillimeterToNauticalMiles(this double x) => Units.Length.Millimeter.toNauticalMiles(x); + public static double MillimeterToChains(this double x) => Units.Length.Millimeter.toChains(x); + public static double MillimeterToFurlongs(this double x) => Units.Length.Millimeter.toFurlongs(x); + public static double MillimeterToLeagues(this double x) => Units.Length.Millimeter.toLeagues(x); + public static double MillimeterToHands(this double x) => Units.Length.Millimeter.toHands(x); + public static double MillimeterToRods(this double x) => Units.Length.Millimeter.toRods(x); +} + +public static class CentimeterExtensions +{ + public static double CentimeterToInches(this double x) => Units.Length.Centimeter.toInches(x); + public static double CentimeterToFeet(this double x) => Units.Length.Centimeter.toFeet(x); + public static double CentimeterToYards(this double x) => Units.Length.Centimeter.toYards(x); + public static double CentimeterToMiles(this double x) => Units.Length.Centimeter.toMiles(x); + public static double CentimeterToMillimeters(this double x) => Units.Length.Centimeter.toMillimeters(x); + public static double CentimeterToDecimeters(this double x) => Units.Length.Centimeter.toDecimeters(x); + public static double CentimeterToMeters(this double x) => Units.Length.Centimeter.toMeters(x); + public static double CentimeterToKilometers(this double x) => Units.Length.Centimeter.toKilometers(x); + public static double CentimeterToNauticalMiles(this double x) => Units.Length.Centimeter.toNauticalMiles(x); + public static double CentimeterToChains(this double x) => Units.Length.Centimeter.toChains(x); + public static double CentimeterToFurlongs(this double x) => Units.Length.Centimeter.toFurlongs(x); + public static double CentimeterToLeagues(this double x) => Units.Length.Centimeter.toLeagues(x); + public static double CentimeterToHands(this double x) => Units.Length.Centimeter.toHands(x); + public static double CentimeterToRods(this double x) => Units.Length.Centimeter.toRods(x); +} + +public static class DecimeterExtensions +{ + public static double DecimeterToInches(this double x) => Units.Length.Decimeter.toInches(x); + public static double DecimeterToFeet(this double x) => Units.Length.Decimeter.toFeet(x); + public static double DecimeterToYards(this double x) => Units.Length.Decimeter.toYards(x); + public static double DecimeterToMiles(this double x) => Units.Length.Decimeter.toMiles(x); + public static double DecimeterToMillimeters(this double x) => Units.Length.Decimeter.toMillimeters(x); + public static double DecimeterToCentimeters(this double x) => Units.Length.Decimeter.toCentimeters(x); + public static double DecimeterToMeters(this double x) => Units.Length.Decimeter.toMeters(x); + public static double DecimeterToKilometers(this double x) => Units.Length.Decimeter.toKilometers(x); + public static double DecimeterToNauticalMiles(this double x) => Units.Length.Decimeter.toNauticalMiles(x); + public static double DecimeterToChains(this double x) => Units.Length.Decimeter.toChains(x); + public static double DecimeterToFurlongs(this double x) => Units.Length.Decimeter.toFurlongs(x); + public static double DecimeterToLeagues(this double x) => Units.Length.Decimeter.toLeagues(x); + public static double DecimeterToHands(this double x) => Units.Length.Decimeter.toHands(x); + public static double DecimeterToRods(this double x) => Units.Length.Decimeter.toRods(x); +} + +public static class MeterExtensions +{ + public static double MeterToInches(this double x) => Units.Length.Meter.toInches(x); + public static double MeterToFeet(this double x) => Units.Length.Meter.toFeet(x); + public static double MeterToYards(this double x) => Units.Length.Meter.toYards(x); + public static double MeterToMiles(this double x) => Units.Length.Meter.toMiles(x); + public static double MeterToMillimeters(this double x) => Units.Length.Meter.toMillimeters(x); + public static double MeterToCentimeters(this double x) => Units.Length.Meter.toCentimeters(x); + public static double MeterToDecimeters(this double x) => Units.Length.Meter.toDecimeters(x); + public static double MeterToKilometers(this double x) => Units.Length.Meter.toKilometers(x); + public static double MeterToNauticalMiles(this double x) => Units.Length.Meter.toNauticalMiles(x); + public static double MeterToChains(this double x) => Units.Length.Meter.toChains(x); + public static double MeterToFurlongs(this double x) => Units.Length.Meter.toFurlongs(x); + public static double MeterToLeagues(this double x) => Units.Length.Meter.toLeagues(x); + public static double MeterToHands(this double x) => Units.Length.Meter.toHands(x); + public static double MeterToRods(this double x) => Units.Length.Meter.toRods(x); +} + +public static class KilometerExtensions +{ + public static double KilometerToInches(this double x) => Units.Length.Kilometer.toInches(x); + public static double KilometerToFeet(this double x) => Units.Length.Kilometer.toFeet(x); + public static double KilometerToYards(this double x) => Units.Length.Kilometer.toYards(x); + public static double KilometerToMiles(this double x) => Units.Length.Kilometer.toMiles(x); + public static double KilometerToMillimeters(this double x) => Units.Length.Kilometer.toMillimeters(x); + public static double KilometerToCentimeters(this double x) => Units.Length.Kilometer.toCentimeters(x); + public static double KilometerToDecimeters(this double x) => Units.Length.Kilometer.toDecimeters(x); + public static double KilometerToMeters(this double x) => Units.Length.Kilometer.toMeters(x); + public static double KilometerToNauticalMiles(this double x) => Units.Length.Kilometer.toNauticalMiles(x); + public static double KilometerToChains(this double x) => Units.Length.Kilometer.toChains(x); + public static double KilometerToFurlongs(this double x) => Units.Length.Kilometer.toFurlongs(x); + public static double KilometerToLeagues(this double x) => Units.Length.Kilometer.toLeagues(x); + public static double KilometerToHands(this double x) => Units.Length.Kilometer.toHands(x); + public static double KilometerToRods(this double x) => Units.Length.Kilometer.toRods(x); +} + +public static class NauticalMileExtensions +{ + public static double NauticalMileToInches(this double x) => Units.Length.NauticalMile.toInches(x); + public static double NauticalMileToFeet(this double x) => Units.Length.NauticalMile.toFeet(x); + public static double NauticalMileToYards(this double x) => Units.Length.NauticalMile.toYards(x); + public static double NauticalMileToMiles(this double x) => Units.Length.NauticalMile.toMiles(x); + public static double NauticalMileToMillimeters(this double x) => Units.Length.NauticalMile.toMillimeters(x); + public static double NauticalMileToCentimeters(this double x) => Units.Length.NauticalMile.toCentimeters(x); + public static double NauticalMileToDecimeters(this double x) => Units.Length.NauticalMile.toDecimeters(x); + public static double NauticalMileToMeters(this double x) => Units.Length.NauticalMile.toMeters(x); + public static double NauticalMileToKilometers(this double x) => Units.Length.NauticalMile.toKilometers(x); + public static double NauticalMileToChains(this double x) => Units.Length.NauticalMile.toChains(x); + public static double NauticalMileToFurlongs(this double x) => Units.Length.NauticalMile.toFurlongs(x); + public static double NauticalMileToLeagues(this double x) => Units.Length.NauticalMile.toLeagues(x); + public static double NauticalMileToHands(this double x) => Units.Length.NauticalMile.toHands(x); + public static double NauticalMileToRods(this double x) => Units.Length.NauticalMile.toRods(x); +} + +public static class ChainExtensions +{ + public static double ChainToInches(this double x) => Units.Length.Chain.toInches(x); + public static double ChainToFeet(this double x) => Units.Length.Chain.toFeet(x); + public static double ChainToYards(this double x) => Units.Length.Chain.toYards(x); + public static double ChainToMiles(this double x) => Units.Length.Chain.toMiles(x); + public static double ChainToMillimeters(this double x) => Units.Length.Chain.toMillimeters(x); + public static double ChainToCentimeters(this double x) => Units.Length.Chain.toCentimeters(x); + public static double ChainToDecimeters(this double x) => Units.Length.Chain.toDecimeters(x); + public static double ChainToMeters(this double x) => Units.Length.Chain.toMeters(x); + public static double ChainToKilometers(this double x) => Units.Length.Chain.toKilometers(x); + public static double ChainToNauticalMiles(this double x) => Units.Length.Chain.toNauticalMiles(x); + public static double ChainToFurlongs(this double x) => Units.Length.Chain.toFurlongs(x); + public static double ChainToLeagues(this double x) => Units.Length.Chain.toLeagues(x); + public static double ChainToHands(this double x) => Units.Length.Chain.toHands(x); + public static double ChainToRods(this double x) => Units.Length.Chain.toRods(x); +} + +public static class FurlongExtensions +{ + public static double FurlongToInches(this double x) => Units.Length.Furlong.toInches(x); + public static double FurlongToFeet(this double x) => Units.Length.Furlong.toFeet(x); + public static double FurlongToYards(this double x) => Units.Length.Furlong.toYards(x); + public static double FurlongToMiles(this double x) => Units.Length.Furlong.toMiles(x); + public static double FurlongToMillimeters(this double x) => Units.Length.Furlong.toMillimeters(x); + public static double FurlongToCentimeters(this double x) => Units.Length.Furlong.toCentimeters(x); + public static double FurlongToDecimeters(this double x) => Units.Length.Furlong.toDecimeters(x); + public static double FurlongToMeters(this double x) => Units.Length.Furlong.toMeters(x); + public static double FurlongToKilometers(this double x) => Units.Length.Furlong.toKilometers(x); + public static double FurlongToNauticalMiles(this double x) => Units.Length.Furlong.toNauticalMiles(x); + public static double FurlongToChains(this double x) => Units.Length.Furlong.toChains(x); + public static double FurlongToLeagues(this double x) => Units.Length.Furlong.toLeagues(x); + public static double FurlongToHands(this double x) => Units.Length.Furlong.toHands(x); + public static double FurlongToRods(this double x) => Units.Length.Furlong.toRods(x); +} + +public static class LeagueExtensions +{ + public static double LeagueToInches(this double x) => Units.Length.League.toInches(x); + public static double LeagueToFeet(this double x) => Units.Length.League.toFeet(x); + public static double LeagueToYards(this double x) => Units.Length.League.toYards(x); + public static double LeagueToMiles(this double x) => Units.Length.League.toMiles(x); + public static double LeagueToMillimeters(this double x) => Units.Length.League.toMillimeters(x); + public static double LeagueToCentimeters(this double x) => Units.Length.League.toCentimeters(x); + public static double LeagueToDecimeters(this double x) => Units.Length.League.toDecimeters(x); + public static double LeagueToMeters(this double x) => Units.Length.League.toMeters(x); + public static double LeagueToKilometers(this double x) => Units.Length.League.toKilometers(x); + public static double LeagueToNauticalMiles(this double x) => Units.Length.League.toNauticalMiles(x); + public static double LeagueToChains(this double x) => Units.Length.League.toChains(x); + public static double LeagueToFurlongs(this double x) => Units.Length.League.toFurlongs(x); + public static double LeagueToHands(this double x) => Units.Length.League.toHands(x); + public static double LeagueToRods(this double x) => Units.Length.League.toRods(x); +} + +public static class HandExtensions +{ + public static double HandToInches(this double x) => Units.Length.Hand.toInches(x); + public static double HandToFeet(this double x) => Units.Length.Hand.toFeet(x); + public static double HandToYards(this double x) => Units.Length.Hand.toYards(x); + public static double HandToMiles(this double x) => Units.Length.Hand.toMiles(x); + public static double HandToMillimeters(this double x) => Units.Length.Hand.toMillimeters(x); + public static double HandToCentimeters(this double x) => Units.Length.Hand.toCentimeters(x); + public static double HandToDecimeters(this double x) => Units.Length.Hand.toDecimeters(x); + public static double HandToMeters(this double x) => Units.Length.Hand.toMeters(x); + public static double HandToKilometers(this double x) => Units.Length.Hand.toKilometers(x); + public static double HandToNauticalMiles(this double x) => Units.Length.Hand.toNauticalMiles(x); + public static double HandToChains(this double x) => Units.Length.Hand.toChains(x); + public static double HandToFurlongs(this double x) => Units.Length.Hand.toFurlongs(x); + public static double HandToLeagues(this double x) => Units.Length.Hand.toLeagues(x); + public static double HandToRods(this double x) => Units.Length.Hand.toRods(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Mass.cs b/src/Fs.Units.CSharp/Simple/Mass.cs new file mode 100644 index 0000000..39ef775 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Mass.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class MilligramExtensions +{ + public static double MilligramToGrams(this double x) => Units.Mass.Milligram.toGrams(x); + public static double MilligramToKilograms(this double x) => Units.Mass.Milligram.toKilograms(x); + public static double MilligramToPoundMass(this double x) => Units.Mass.Milligram.toPoundMass(x); +} + +public static class GramExtensions +{ + public static double GramToMilligrams(this double x) => Units.Mass.Gram.toMilligrams(x); + public static double GramToKilograms(this double x) => Units.Mass.Gram.toKilograms(x); + public static double GramToPoundMass(this double x) => Units.Mass.Gram.toPoundMass(x); +} + +public static class KilogramExtensions +{ + public static double KilogramToMilligrams(this double x) => Units.Mass.Kilogram.toMilligrams(x); + public static double KilogramToGrams(this double x) => Units.Mass.Kilogram.toGrams(x); + public static double KilogramToPoundMass(this double x) => Units.Mass.Kilogram.toPoundMass(x); +} + +public static class PoundMassExtensions +{ + public static double PoundMassToMilligrams(this double x) => Units.Mass.PoundMass.toMilligrams(x); + public static double PoundMassToGrams(this double x) => Units.Mass.PoundMass.toGrams(x); + public static double PoundMassToKilograms(this double x) => Units.Mass.PoundMass.toKilograms(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Temperature.cs b/src/Fs.Units.CSharp/Simple/Temperature.cs new file mode 100644 index 0000000..b427c1c --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Temperature.cs @@ -0,0 +1,30 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class KelvinExtensions +{ + public static double KelvinToCelsius(this double x) => Units.Temperature.Kelvin.toCelsius(x); + public static double KelvinToFahrenheit(this double x) => Units.Temperature.Kelvin.toFahrenheit(x); + public static double KelvinToRankine(this double x) => Units.Temperature.Kelvin.toRankine(x); +} + +public static class CelsiusExtensions +{ + public static double CelsiusToKelvin(this double x) => Units.Temperature.Celsius.toKelvin(x); + public static double CelsiusToFahrenheit(this double x) => Units.Temperature.Celsius.toFahrenheit(x); + public static double CelsiusToRankine(this double x) => Units.Temperature.Celsius.toRankine(x); +} + +public static class FahrenheitExtensions +{ + public static double FahrenheitToKelvin(this double x) => Units.Temperature.Fahrenheit.toKelvin(x); + public static double FahrenheitToCelsius(this double x) => Units.Temperature.Fahrenheit.toCelsius(x); + public static double FahrenheitToRankine(this double x) => Units.Temperature.Fahrenheit.toRankine(x); +} + +public static class RankineExtensions +{ + public static double RankineToKelvin(this double x) => Units.Temperature.Rankine.toKelvin(x); + public static double RankineToCelsius(this double x) => Units.Temperature.Rankine.toCelsius(x); + public static double RankineToFahrenheit(this double x) => Units.Temperature.Rankine.toFahrenheit(x); +} \ No newline at end of file diff --git a/src/Fs.Units.CSharp/Simple/Time.cs b/src/Fs.Units.CSharp/Simple/Time.cs new file mode 100644 index 0000000..6dfe100 --- /dev/null +++ b/src/Fs.Units.CSharp/Simple/Time.cs @@ -0,0 +1,272 @@ +// ReSharper disable once CheckNamespace +namespace Fs.Units.CSharp; + +public static class NanosecondExtensions +{ + public static double NanosecondToMicroseconds(this double x) => Units.Time.Nanosecond.toMicroSeconds(x); + public static double NanosecondToMilliseconds(this double x) => Units.Time.Nanosecond.toMilliSeconds(x); + public static double NanosecondToSeconds(this double x) => Units.Time.Nanosecond.toSeconds(x); + public static double NanosecondToMinutes(this double x) => Units.Time.Nanosecond.toMinutes(x); + public static double NanosecondToHours(this double x) => Units.Time.Nanosecond.toHours(x); + public static double NanosecondToDays(this double x) => Units.Time.Nanosecond.toDays(x); + public static double NanosecondToWeeks(this double x) => Units.Time.Nanosecond.toWeeks(x); + public static double NanosecondToFortnights(this double x) => Units.Time.Nanosecond.toFortnights(x); + public static double NanosecondToMonths(this double x) => Units.Time.Nanosecond.toMonths(x); + public static double NanosecondToYears(this double x) => Units.Time.Nanosecond.toYears(x); + public static double NanosecondToDecades(this double x) => Units.Time.Nanosecond.toDecades(x); + public static double NanosecondToCenturies(this double x) => Units.Time.Nanosecond.toCenturies(x); + public static double NanosecondToMillennia(this double x) => Units.Time.Nanosecond.toMillennia(x); + public static double NanosecondToEons(this double x) => Units.Time.Nanosecond.toEons(x); +} + +public static class MicrosecondExtensions +{ + public static double MicrosecondToNanoseconds(this double x) => Units.Time.Microsecond.toNanoSeconds(x); + public static double MicrosecondToMilliseconds(this double x) => Units.Time.Microsecond.toMilliSeconds(x); + public static double MicrosecondToSeconds(this double x) => Units.Time.Microsecond.toSeconds(x); + public static double MicrosecondToMinutes(this double x) => Units.Time.Microsecond.toMinutes(x); + public static double MicrosecondToHours(this double x) => Units.Time.Microsecond.toHours(x); + public static double MicrosecondToDays(this double x) => Units.Time.Microsecond.toDays(x); + public static double MicrosecondToWeeks(this double x) => Units.Time.Microsecond.toWeeks(x); + public static double MicrosecondToFortnights(this double x) => Units.Time.Microsecond.toFortnights(x); + public static double MicrosecondToMonths(this double x) => Units.Time.Microsecond.toMonths(x); + public static double MicrosecondToYears(this double x) => Units.Time.Microsecond.toYears(x); + public static double MicrosecondToDecades(this double x) => Units.Time.Microsecond.toDecades(x); + public static double MicrosecondToCenturies(this double x) => Units.Time.Microsecond.toCenturies(x); + public static double MicrosecondToMillennia(this double x) => Units.Time.Microsecond.toMillennia(x); + public static double MicrosecondToEons(this double x) => Units.Time.Microsecond.toEons(x); +} + +public static class MillisecondExtensions +{ + public static double MillisecondToNanoseconds(this double x) => Units.Time.Millisecond.toNanoSeconds(x); + public static double MillisecondToMicroseconds(this double x) => Units.Time.Millisecond.toMicroSeconds(x); + public static double MillisecondToSeconds(this double x) => Units.Time.Millisecond.toSeconds(x); + public static double MillisecondToMinutes(this double x) => Units.Time.Millisecond.toMinutes(x); + public static double MillisecondToHours(this double x) => Units.Time.Millisecond.toHours(x); + public static double MillisecondToDays(this double x) => Units.Time.Millisecond.toDays(x); + public static double MillisecondToWeeks(this double x) => Units.Time.Millisecond.toWeeks(x); + public static double MillisecondToFortnights(this double x) => Units.Time.Millisecond.toFortnights(x); + public static double MillisecondToMonths(this double x) => Units.Time.Millisecond.toMonths(x); + public static double MillisecondToYears(this double x) => Units.Time.Millisecond.toYears(x); + public static double MillisecondToDecades(this double x) => Units.Time.Millisecond.toDecades(x); + public static double MillisecondToCenturies(this double x) => Units.Time.Millisecond.toCenturies(x); + public static double MillisecondToMillennia(this double x) => Units.Time.Millisecond.toMillennia(x); + public static double MillisecondToEons(this double x) => Units.Time.Millisecond.toEons(x); +} + +public static class SecondExtensions +{ + public static double SecondToNanoseconds(this double x) => Units.Time.Second.toNanoSeconds(x); + public static double SecondToMicroseconds(this double x) => Units.Time.Second.toMicroSeconds(x); + public static double SecondToMilliseconds(this double x) => Units.Time.Second.toMilliSeconds(x); + public static double SecondToMinutes(this double x) => Units.Time.Second.toMinutes(x); + public static double SecondToHours(this double x) => Units.Time.Second.toHours(x); + public static double SecondToDays(this double x) => Units.Time.Second.toDays(x); + public static double SecondToWeeks(this double x) => Units.Time.Second.toWeeks(x); + public static double SecondToFortnights(this double x) => Units.Time.Second.toFortnights(x); + public static double SecondToMonths(this double x) => Units.Time.Second.toMonths(x); + public static double SecondToYears(this double x) => Units.Time.Second.toYears(x); + public static double SecondToDecades(this double x) => Units.Time.Second.toDecades(x); + public static double SecondToCenturies(this double x) => Units.Time.Second.toCenturies(x); + public static double SecondToMillennia(this double x) => Units.Time.Second.toMillennia(x); + public static double SecondToEons(this double x) => Units.Time.Second.toEons(x); +} + +public static class MinuteExtensions +{ + public static double MinuteToNanoseconds(this double x) => Units.Time.Minute.toNanoSeconds(x); + public static double MinuteToMicroseconds(this double x) => Units.Time.Minute.toMicroSeconds(x); + public static double MinuteToMilliseconds(this double x) => Units.Time.Minute.toMilliSeconds(x); + public static double MinuteToSeconds(this double x) => Units.Time.Minute.toSeconds(x); + public static double MinuteToHours(this double x) => Units.Time.Minute.toHours(x); + public static double MinuteToDays(this double x) => Units.Time.Minute.toDays(x); + public static double MinuteToWeeks(this double x) => Units.Time.Minute.toWeeks(x); + public static double MinuteToFortnights(this double x) => Units.Time.Minute.toFortnights(x); + public static double MinuteToMonths(this double x) => Units.Time.Minute.toMonths(x); + public static double MinuteToYears(this double x) => Units.Time.Minute.toYears(x); + public static double MinuteToDecades(this double x) => Units.Time.Minute.toDecades(x); + public static double MinuteToCenturies(this double x) => Units.Time.Minute.toCenturies(x); + public static double MinuteToMillennia(this double x) => Units.Time.Minute.toMillennia(x); + public static double MinuteToEons(this double x) => Units.Time.Minute.toEons(x); +} + +public static class HourExtensions +{ + public static double HourToNanoseconds(this double x) => Units.Time.Hour.toNanoSeconds(x); + public static double HourToMicroseconds(this double x) => Units.Time.Hour.toMicroSeconds(x); + public static double HourToMilliseconds(this double x) => Units.Time.Hour.toMilliSeconds(x); + public static double HourToSeconds(this double x) => Units.Time.Hour.toSeconds(x); + public static double HourToMinutes(this double x) => Units.Time.Hour.toMinutes(x); + public static double HourToDays(this double x) => Units.Time.Hour.toDays(x); + public static double HourToWeeks(this double x) => Units.Time.Hour.toWeeks(x); + public static double HourToFortnights(this double x) => Units.Time.Hour.toFortnights(x); + public static double HourToMonths(this double x) => Units.Time.Hour.toMonths(x); + public static double HourToYears(this double x) => Units.Time.Hour.toYears(x); + public static double HourToDecades(this double x) => Units.Time.Hour.toDecades(x); + public static double HourToCenturies(this double x) => Units.Time.Hour.toCenturies(x); + public static double HourToMillennia(this double x) => Units.Time.Hour.toMillennia(x); + public static double HourToEons(this double x) => Units.Time.Hour.toEons(x); +} + +public static class DayExtensions +{ + public static double DayToNanoseconds(this double x) => Units.Time.Day.toNanoSeconds(x); + public static double DayToMicroseconds(this double x) => Units.Time.Day.toMicroSeconds(x); + public static double DayToMilliseconds(this double x) => Units.Time.Day.toMilliSeconds(x); + public static double DayToSeconds(this double x) => Units.Time.Day.toSeconds(x); + public static double DayToMinutes(this double x) => Units.Time.Day.toMinutes(x); + public static double DayToHours(this double x) => Units.Time.Day.toHours(x); + public static double DayToWeeks(this double x) => Units.Time.Day.toWeeks(x); + public static double DayToFortnights(this double x) => Units.Time.Day.toFortnights(x); + public static double DayToMonths(this double x) => Units.Time.Day.toMonths(x); + public static double DayToYears(this double x) => Units.Time.Day.toYears(x); + public static double DayToDecades(this double x) => Units.Time.Day.toDecades(x); + public static double DayToCenturies(this double x) => Units.Time.Day.toCenturies(x); + public static double DayToMillennia(this double x) => Units.Time.Day.toMillennia(x); + public static double DayToEons(this double x) => Units.Time.Day.toEons(x); +} + +public static class WeekExtensions +{ + public static double WeekToNanoseconds(this double x) => Units.Time.Week.toNanoSeconds(x); + public static double WeekToMicroseconds(this double x) => Units.Time.Week.toMicroSeconds(x); + public static double WeekToMilliseconds(this double x) => Units.Time.Week.toMilliSeconds(x); + public static double WeekToSeconds(this double x) => Units.Time.Week.toSeconds(x); + public static double WeekToMinutes(this double x) => Units.Time.Week.toMinutes(x); + public static double WeekToHours(this double x) => Units.Time.Week.toHours(x); + public static double WeekToDays(this double x) => Units.Time.Week.toDays(x); + public static double WeekToFortnights(this double x) => Units.Time.Week.toFortnights(x); + public static double WeekToMonths(this double x) => Units.Time.Week.toMonths(x); + public static double WeekToYears(this double x) => Units.Time.Week.toYears(x); + public static double WeekToDecades(this double x) => Units.Time.Week.toDecades(x); + public static double WeekToCenturies(this double x) => Units.Time.Week.toCenturies(x); + public static double WeekToMillennia(this double x) => Units.Time.Week.toMillennia(x); + public static double WeekToEons(this double x) => Units.Time.Week.toEons(x); +} + +public static class FortnightExtensions +{ + public static double FortnightToNanoseconds(this double x) => Units.Time.Fortnight.toNanoSeconds(x); + public static double FortnightToMicroseconds(this double x) => Units.Time.Fortnight.toMicroSeconds(x); + public static double FortnightToMilliseconds(this double x) => Units.Time.Fortnight.toMilliSeconds(x); + public static double FortnightToSeconds(this double x) => Units.Time.Fortnight.toSeconds(x); + public static double FortnightToMinutes(this double x) => Units.Time.Fortnight.toMinutes(x); + public static double FortnightToHours(this double x) => Units.Time.Fortnight.toHours(x); + public static double FortnightToDays(this double x) => Units.Time.Fortnight.toDays(x); + public static double FortnightToWeeks(this double x) => Units.Time.Fortnight.toWeeks(x); + public static double FortnightToMonths(this double x) => Units.Time.Fortnight.toMonths(x); + public static double FortnightToYears(this double x) => Units.Time.Fortnight.toYears(x); + public static double FortnightToDecades(this double x) => Units.Time.Fortnight.toDecades(x); + public static double FortnightToCenturies(this double x) => Units.Time.Fortnight.toCenturies(x); + public static double FortnightToMillennia(this double x) => Units.Time.Fortnight.toMillennia(x); + public static double FortnightToEons(this double x) => Units.Time.Fortnight.toEons(x); +} + +public static class MonthExtensions +{ + public static double MonthToNanoseconds(this double x) => Units.Time.Month.toNanoSeconds(x); + public static double MonthToMicroseconds(this double x) => Units.Time.Month.toMicroSeconds(x); + public static double MonthToMilliseconds(this double x) => Units.Time.Month.toMilliSeconds(x); + public static double MonthToSeconds(this double x) => Units.Time.Month.toSeconds(x); + public static double MonthToMinutes(this double x) => Units.Time.Month.toMinutes(x); + public static double MonthToHours(this double x) => Units.Time.Month.toHours(x); + public static double MonthToDays(this double x) => Units.Time.Month.toDays(x); + public static double MonthToWeeks(this double x) => Units.Time.Month.toWeeks(x); + public static double MonthToFortnights(this double x) => Units.Time.Month.toFortnights(x); + public static double MonthToYears(this double x) => Units.Time.Month.toYears(x); + public static double MonthToDecades(this double x) => Units.Time.Month.toDecades(x); + public static double MonthToCenturies(this double x) => Units.Time.Month.toCenturies(x); + public static double MonthToMillennia(this double x) => Units.Time.Month.toMillennia(x); + public static double MonthToEons(this double x) => Units.Time.Month.toEons(x); +} + +public static class YearExtensions +{ + public static double YearToNanoseconds(this double x) => Units.Time.Year.toNanoSeconds(x); + public static double YearToMicroseconds(this double x) => Units.Time.Year.toMicroSeconds(x); + public static double YearToMilliseconds(this double x) => Units.Time.Year.toMilliSeconds(x); + public static double YearToSeconds(this double x) => Units.Time.Year.toSeconds(x); + public static double YearToMinutes(this double x) => Units.Time.Year.toMinutes(x); + public static double YearToHours(this double x) => Units.Time.Year.toHours(x); + public static double YearToDays(this double x) => Units.Time.Year.toDays(x); + public static double YearToWeeks(this double x) => Units.Time.Year.toWeeks(x); + public static double YearToFortnights(this double x) => Units.Time.Year.toFortnights(x); + public static double YearToMonths(this double x) => Units.Time.Year.toMonths(x); + public static double YearToDecades(this double x) => Units.Time.Year.toDecades(x); + public static double YearToCenturies(this double x) => Units.Time.Year.toCenturies(x); + public static double YearToMillennia(this double x) => Units.Time.Year.toMillennia(x); + public static double YearToEons(this double x) => Units.Time.Year.toEons(x); +} + +public static class DecadeExtensions +{ + public static double DecadeToNanoseconds(this double x) => Units.Time.Decade.toNanoSeconds(x); + public static double DecadeToMicroseconds(this double x) => Units.Time.Decade.toMicroSeconds(x); + public static double DecadeToMilliseconds(this double x) => Units.Time.Decade.toMilliSeconds(x); + public static double DecadeToSeconds(this double x) => Units.Time.Decade.toSeconds(x); + public static double DecadeToMinutes(this double x) => Units.Time.Decade.toMinutes(x); + public static double DecadeToHours(this double x) => Units.Time.Decade.toHours(x); + public static double DecadeToDays(this double x) => Units.Time.Decade.toDays(x); + public static double DecadeToWeeks(this double x) => Units.Time.Decade.toWeeks(x); + public static double DecadeToFortnights(this double x) => Units.Time.Decade.toFortnights(x); + public static double DecadeToMonths(this double x) => Units.Time.Decade.toMonths(x); + public static double DecadeToYears(this double x) => Units.Time.Decade.toYears(x); + public static double DecadeToCenturies(this double x) => Units.Time.Decade.toCenturies(x); + public static double DecadeToMillennia(this double x) => Units.Time.Decade.toMillennia(x); + public static double DecadeToEons(this double x) => Units.Time.Decade.toEons(x); +} + +public static class CenturyExtensions +{ + public static double CenturyToNanoseconds(this double x) => Units.Time.Century.toNanoSeconds(x); + public static double CenturyToMicroseconds(this double x) => Units.Time.Century.toMicroSeconds(x); + public static double CenturyToMilliseconds(this double x) => Units.Time.Century.toMilliSeconds(x); + public static double CenturyToSeconds(this double x) => Units.Time.Century.toSeconds(x); + public static double CenturyToMinutes(this double x) => Units.Time.Century.toMinutes(x); + public static double CenturyToHours(this double x) => Units.Time.Century.toHours(x); + public static double CenturyToDays(this double x) => Units.Time.Century.toDays(x); + public static double CenturyToWeeks(this double x) => Units.Time.Century.toWeeks(x); + public static double CenturyToFortnights(this double x) => Units.Time.Century.toFortnights(x); + public static double CenturyToMonths(this double x) => Units.Time.Century.toMonths(x); + public static double CenturyToYears(this double x) => Units.Time.Century.toYears(x); + public static double CenturyToDecades(this double x) => Units.Time.Century.toDecades(x); + public static double CenturyToMillennia(this double x) => Units.Time.Century.toMillennia(x); + public static double CenturyToEons(this double x) => Units.Time.Century.toEons(x); +} + +public static class MillenniumExtensions +{ + public static double MillenniumToNanoseconds(this double x) => Units.Time.Millennium.toNanoSeconds(x); + public static double MillenniumToMicroseconds(this double x) => Units.Time.Millennium.toMicroSeconds(x); + public static double MillenniumToMilliseconds(this double x) => Units.Time.Millennium.toMilliSeconds(x); + public static double MillenniumToSeconds(this double x) => Units.Time.Millennium.toSeconds(x); + public static double MillenniumToMinutes(this double x) => Units.Time.Millennium.toMinutes(x); + public static double MillenniumToHours(this double x) => Units.Time.Millennium.toHours(x); + public static double MillenniumToDays(this double x) => Units.Time.Millennium.toDays(x); + public static double MillenniumToWeeks(this double x) => Units.Time.Millennium.toWeeks(x); + public static double MillenniumToFortnights(this double x) => Units.Time.Millennium.toFortnights(x); + public static double MillenniumToMonths(this double x) => Units.Time.Millennium.toMonths(x); + public static double MillenniumToYears(this double x) => Units.Time.Millennium.toYears(x); + public static double MillenniumToDecades(this double x) => Units.Time.Millennium.toDecades(x); + public static double MillenniumToCenturies(this double x) => Units.Time.Millennium.toCenturies(x); + public static double MillenniumToEons(this double x) => Units.Time.Millennium.toEons(x); +} + +public static class EonExtensions +{ + public static double EonToNanoseconds(this double x) => Units.Time.Eon.toNanoSeconds(x); + public static double EonToMicroseconds(this double x) => Units.Time.Eon.toMicroSeconds(x); + public static double EonToMilliseconds(this double x) => Units.Time.Eon.toMilliSeconds(x); + public static double EonToSeconds(this double x) => Units.Time.Eon.toSeconds(x); + public static double EonToMinutes(this double x) => Units.Time.Eon.toMinutes(x); + public static double EonToHours(this double x) => Units.Time.Eon.toHours(x); + public static double EonToDays(this double x) => Units.Time.Eon.toDays(x); + public static double EonToWeeks(this double x) => Units.Time.Eon.toWeeks(x); + public static double EonToFortnights(this double x) => Units.Time.Eon.toFortnights(x); + public static double EonToMonths(this double x) => Units.Time.Eon.toMonths(x); + public static double EonToYears(this double x) => Units.Time.Eon.toYears(x); + public static double EonToDecades(this double x) => Units.Time.Eon.toDecades(x); + public static double EonToCenturies(this double x) => Units.Time.Eon.toCenturies(x); + public static double EonToMillennia(this double x) => Units.Time.Eon.toMillennia(x); +} \ No newline at end of file diff --git a/src/Fs.Units/AssemblyInfo.fs b/src/Fs.Units/AssemblyInfo.fs new file mode 100644 index 0000000..6bf5c25 --- /dev/null +++ b/src/Fs.Units/AssemblyInfo.fs @@ -0,0 +1,19 @@ +// Auto-Generated by FAKE; do not edit +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "Fs.Units" + let [] AssemblyProduct = "Fs.Units" + let [] AssemblyDescription = "A simple library for working with units of measure in .NET" + let [] AssemblyVersion = "2.0.0" + let [] AssemblyFileVersion = "2.0.0" + let [] AssemblyConfiguration = "Release" diff --git a/src/Fs.Units/Compound/Area.fs b/src/Fs.Units/Compound/Area.fs new file mode 100644 index 0000000..cdfbb85 --- /dev/null +++ b/src/Fs.Units/Compound/Area.fs @@ -0,0 +1,88 @@ +namespace Fs.Units + +[] +module Area = + + /// Square inch + [] + type in2 = inch * inch + + /// Square foot + [] + type ft2 = ft * ft + + /// Square centimeter + [] + type cm2 = cm * cm + + /// Square meter + [] + type m2 = m * m + + [] + module SquareInch = + + let create (x: float) = x * 1.0 + + let toSquareFeet (x: float) = + let length = Inch.create 1 |> Inch.toFeet + x * length * length / 1.0 + + let toSquareCentimeters (x: float) = + let length = Inch.create 1 |> Inch.toCentimeters + x * length * length / 1.0 + + let toSquareMeters (x: float) = + let length = Inch.create 1 |> Inch.toMeters + x * length * length / 1.0 + + [] + module SquareFoot = + + let create (x: float) = x * 1.0 + + let toSquareInches (x: float) = + let length = Foot.create 1 |> Foot.toInches + x * (length * length) / 1.0 + + let toSquareCentimeters (x: float) = + let length = Foot.create 1 |> Foot.toCentimeters + x * length * length / 1.0 + + let toSquareMeters (x: float) = + let length = Foot.create 1 |> Foot.toMeters + x * length * length / 1.0 + + [] + module SquareCentimeter = + + let create (x: float) = x * 1.0 + + let toSquareInches (x: float) = + let length = Centimeter.create 1 |> Centimeter.toInches + x * length * length / 1.0 + + let toSquareFeet (x: float) = + let length = Centimeter.create 1 |> Centimeter.toFeet + x * length * length / 1.0 + + let toSquareMeters (x: float) = + let length = Centimeter.create 1 |> Centimeter.toMeters + x * length * length / 1.0 + + [] + module SquareMeter = + + let create (x: float) = x * 1.0 + + let toSquareInches (x: float) = + let length = Meter.create 1 |> Meter.toInches + x * length * length / 1.0 + + let toSquareFeet (x: float) = + let length = Meter.create 1 |> Meter.toFeet + x * length * length / 1.0 + + let toSquareCentimeters (x: float) = + let length = Meter.create 1 |> Meter.toCentimeters + x * length * length / 1.0 diff --git a/src/Fs.Units/Compound/Capacitance.fs b/src/Fs.Units/Compound/Capacitance.fs new file mode 100644 index 0000000..258de13 --- /dev/null +++ b/src/Fs.Units/Compound/Capacitance.fs @@ -0,0 +1,13 @@ +namespace Fs.Units + +[] +module Capacitance = + + /// Farad + [] + type F = s * s * s * s * A * A / m / m / kg + + [] + module Farad = + + let create (x: float) = x * 1.0 diff --git a/Fs.Units/Compound/DataTransferRate.fs b/src/Fs.Units/Compound/DataTransferRate.fs similarity index 87% rename from Fs.Units/Compound/DataTransferRate.fs rename to src/Fs.Units/Compound/DataTransferRate.fs index 31bfca6..a483421 100644 --- a/Fs.Units/Compound/DataTransferRate.fs +++ b/src/Fs.Units/Compound/DataTransferRate.fs @@ -1,53 +1,63 @@ -namespace Fs.Units.DataTransferRate - -open Fs.Units - -module Units = - - /// Baud - [] type baud = DataStorage.Units.b / Time.Units.s - - /// Bit per second - [] type bps = DataStorage.Units.b / Time.Units.s - - /// Kilobit per second - [] type kbps = DataStorage.Units.kb / Time.Units.s - - /// Megabit per second - [] type Mbps = DataStorage.Units.Mb / Time.Units.s - - /// Gigabit per second - [] type Gbps = DataStorage.Units.Gb / Time.Units.s - - /// Terabit per second - [] type Tbps = DataStorage.Units.Tb / Time.Units.s - - /// Petabit per second - [] type Pbps = DataStorage.Units.Pb / Time.Units.s - - /// Byte per second - [] type Bps = DataStorage.Units.B / Time.Units.s - - /// Kilobyte per second - [] type kBps = DataStorage.Units.kB / Time.Units.s - - /// Megabyte per second - [] type MBps = DataStorage.Units.MB / Time.Units.s - - /// Gigabyte per second - [] type GBps = DataStorage.Units.GB / Time.Units.s - - /// Terabyte per second - [] type TBps = DataStorage.Units.TB / Time.Units.s - - /// Petabyte per second - [] type PBps = DataStorage.Units.PB / Time.Units.s - -open Units -open Fs.Units.DataStorage - -module Baud = - +namespace Fs.Units + +[] +module DataTransferRate = + + /// Baud + [] + type baud = b / s + + /// Bit per second + [] + type bps = b / s + + /// Kilobit per second + [] + type kbps = kb / s + + /// Megabit per second + [] + type Mbps = Mb / s + + /// Gigabit per second + [] + type Gbps = Gb / s + + /// Terabit per second + [] + type Tbps = Tb / s + + /// Petabit per second + [] + type Pbps = Pb / s + + /// Byte per second + [] + type Bps = B / s + + /// Kilobyte per second + [] + type kBps = kB / s + + /// Megabyte per second + [] + type MBps = MB / s + + /// Gigabyte per second + [] + type GBps = GB / s + + /// Terabyte per second + [] + type TBps = TB / s + + /// Petabyte per second + [] + type PBps = PB / s + + [] + module Baud = + let create (x: float) = x * 1.0 let toBitsPerSecond (x: float) = x * 1.0 / 1.0 let toKilobitsPerSecond (x: float) = x * 1e-3 / 1.0 @@ -61,9 +71,10 @@ module Baud = let toGigabytesPerSecond (x: float) = x * 1.25e-10 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-13 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-16 / 1.0 - -module BitPerSecond = - + + [] + module BitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1.0 / 1.0 let toKilobitsPerSecond (x: float) = x * 1e-3 / 1.0 @@ -77,9 +88,10 @@ module BitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e-10 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-13 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-16 / 1.0 - -module KilobitPerSecond = - + + [] + module KilobitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1e+3 / 1.0 let toBitsPerSecond (x: float) = x * 1e+3 / 1.0 @@ -93,9 +105,10 @@ module KilobitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e-7 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-10 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-13 / 1.0 - -module MegabitPerSecond = - + + [] + module MegabitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1e+6 / 1.0 let toBitsPerSecond (x: float) = x * 1e+6 / 1.0 @@ -109,9 +122,10 @@ module MegabitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e-4 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-7 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-10 / 1.0 - -module GigabitPerSecond = - + + [] + module GigabitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1e+9 / 1.0 let toBitsPerSecond (x: float) = x * 1e+9 / 1.0 @@ -125,9 +139,10 @@ module GigabitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e-1 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-4 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-7 / 1.0 - -module TerabitPerSecond = - + + [] + module TerabitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1e+12 / 1.0 let toBitsPerSecond (x: float) = x * 1e+12 / 1.0 @@ -141,9 +156,10 @@ module TerabitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e+2 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e-1 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-4 / 1.0 - -module PetabitPerSecond = - + + [] + module PetabitPerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 1e+15 / 1.0 let toBitsPerSecond (x: float) = x * 1e+15 / 1.0 @@ -157,9 +173,10 @@ module PetabitPerSecond = let toGigabytesPerSecond (x: float) = x * 1.25e+5 / 1.0 let toTerabytesPerSecond (x: float) = x * 1.25e+2 / 1.0 let toPetabytesPerSecond (x: float) = x * 1.25e-1 / 1.0 - -module BytePerSecond = - + + [] + module BytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8.0 / 1.0 let toBitsPerSecond (x: float) = x * 8.0 / 1.0 @@ -173,9 +190,10 @@ module BytePerSecond = let toGigabytesPerSecond (x: float) = x * 1e-9 / 1.0 let toTerabytesPerSecond (x: float) = x * 1e-12 / 1.0 let toPetabytesPerSecond (x: float) = x * 1e-15 / 1.0 - -module KilobytePerSecond = - + + [] + module KilobytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8e+3 / 1.0 let toBitsPerSecond (x: float) = x * 8e+3 / 1.0 @@ -189,9 +207,10 @@ module KilobytePerSecond = let toGigabytesPerSecond (x: float) = x * 1e-6 / 1.0 let toTerabytesPerSecond (x: float) = x * 1e-9 / 1.0 let toPetabytesPerSecond (x: float) = x * 1e-12 / 1.0 - -module MegabytePerSecond = - + + [] + module MegabytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8e+6 / 1.0 let toBitsPerSecond (x: float) = x * 8e+6 / 1.0 @@ -205,9 +224,10 @@ module MegabytePerSecond = let toGigabytesPerSecond (x: float) = x * 1e-3 / 1.0 let toTerabytesPerSecond (x: float) = x * 1e-6 / 1.0 let toPetabytesPerSecond (x: float) = x * 1e-9 / 1.0 - -module GigabytePerSecond = - + + [] + module GigabytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8e+9 / 1.0 let toBitsPerSecond (x: float) = x * 8e+9 / 1.0 @@ -221,9 +241,10 @@ module GigabytePerSecond = let toMegabytesPerSecond (x: float) = x * 1e+3 / 1.0 let toTerabytesPerSecond (x: float) = x * 1e-3 / 1.0 let toPetabytesPerSecond (x: float) = x * 1e-6 / 1.0 - -module TerabytePerSecond = - + + [] + module TerabytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8e+12 / 1.0 let toBitsPerSecond (x: float) = x * 8e+12 / 1.0 @@ -237,9 +258,10 @@ module TerabytePerSecond = let toMegabytesPerSecond (x: float) = x * 1e+6 / 1.0 let toGigabytesPerSecond (x: float) = x * 1e+3 / 1.0 let toPetabytesPerSecond (x: float) = x * 1e-3 / 1.0 - -module PetabytePerSecond = - + + [] + module PetabytePerSecond = + let create (x: float) = x * 1.0 let toBauds (x: float) = x * 8e+15 / 1.0 let toBitsPerSecond (x: float) = x * 8e+15 / 1.0 @@ -253,4 +275,3 @@ module PetabytePerSecond = let toMegabytesPerSecond (x: float) = x * 1e+9 / 1.0 let toGigabytesPerSecond (x: float) = x * 1e+6 / 1.0 let toTerabytesPerSecond (x: float) = x * 1e+3 / 1.0 - \ No newline at end of file diff --git a/src/Fs.Units/Compound/Density.fs b/src/Fs.Units/Compound/Density.fs new file mode 100644 index 0000000..63bb11c --- /dev/null +++ b/src/Fs.Units/Compound/Density.fs @@ -0,0 +1,100 @@ +namespace Fs.Units + +[] +module Density = + + /// Kilogram per cubic meter + [] + type kgm3 = kg / m3 + + /// Gram per cubic centimeter + [] + type gcm3 = g / cm3 + + /// Pound mass per cubic foot + [] + type lbmft3 = lbm / ft3 + + /// Pound mass per cubic inch + [] + type lbmin3 = lbm / in3 + + [] + module KilogramPerCubicMeter = + + let create (x: float) = x * 1.0 + + let toGramsPerCubicCentimeter (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toGrams + let volume = CubicMeter.create 1 |> CubicMeter.toCubicCentimeters + x * mass / volume / 1.0 + + let toPoundMassPerCubicFoot (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toPoundMass + let volume = CubicMeter.create 1 |> CubicMeter.toCubicFeet + x * mass / volume / 1.0 + + let toPoundMassPerCubicInch (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toPoundMass + let volume = CubicMeter.create 1 |> CubicMeter.toCubicInches + x * mass / volume / 1.0 + + [] + module GramPerCubicCentimeter = + + let create (x: float) = x * 1.0 + + let toKilogramsPerCubicMeter (x: float) = + let mass = Gram.create 1 |> Gram.toKilograms + let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicMeters + x * mass / volume / 1.0 + + let toPoundMassPerCubicFoot (x: float) = + let mass = Gram.create 1 |> Gram.toPoundMass + let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicFeet + x * mass / volume / 1.0 + + let toPoundMassPerCubicInch (x: float) = + let mass = Gram.create 1 |> Gram.toPoundMass + let volume = CubicCentimeter.create 1 |> CubicCentimeter.toCubicInches + x * mass / volume / 1.0 + + [] + module PoundMassPerCubicFoot = + + let create (x: float) = x * 1.0 + + let toKilogramsPerCubicMeter (x: float) = + let mass = PoundMass.create 1 |> PoundMass.toKilograms + let volume = CubicFoot.create 1 |> CubicFoot.toCubicMeters + x * mass / volume / 1.0 + + let toGramsPerCubicCentimeter (x: float) = + let mass = PoundMass.create 1 |> PoundMass.toGrams + let volume = CubicFoot.create 1 |> CubicFoot.toCubicCentimeters + x * mass / volume / 1.0 + + let toPoundMassPerCubicInch (x: float) = + let mass = PoundMass.create 1 + let volume = CubicFoot.create 1 |> CubicFoot.toCubicInches + x * mass / volume / 1.0 + + [] + module PoundMassPerCubicInch = + + let create (x: float) = x * 1.0 + + let toKilogramsPerCubicMeter (x: float) = + let mass = PoundMass.create 1 |> PoundMass.toKilograms + let volume = CubicInch.create 1 |> CubicInch.toCubicMeters + x * mass / volume / 1.0 + + let toGramsPerCubicCentimeter (x: float) = + let mass = PoundMass.create 1 |> PoundMass.toGrams + let volume = CubicInch.create 1 |> CubicInch.toCubicCentimeters + x * mass / volume / 1.0 + + let toPoundMassPerCubicFoot (x: float) = + let mass = PoundMass.create 1 + let volume = CubicInch.create 1 |> CubicInch.toCubicFeet + x * mass / volume / 1.0 diff --git a/src/Fs.Units/Compound/ElectricCharge.fs b/src/Fs.Units/Compound/ElectricCharge.fs new file mode 100644 index 0000000..9eae3f8 --- /dev/null +++ b/src/Fs.Units/Compound/ElectricCharge.fs @@ -0,0 +1,53 @@ +namespace Fs.Units + +[] +module ElectricCharge = + + /// Coulomb + [] + type C = A * s + + /// Ampere-hour + [] + type Ah = A * hr + + /// Ampere-second + [] + type As = C + + [] + module Coulomb = + + let create (x: float) = x * 1.0 + + let toAmpereHours (x: float) = + let current = Ampere.create 1 + let time = Second.create 1 |> Second.toHours + x * current * time / 1.0 + + let toAmpereSeconds (x: float) = x * 1.0 / 1.0 + + [] + module AmpereHour = + let create (x: float) = x * 1.0 + + let toCoulombs (x: float) = + let current = Ampere.create 1 + let time = Hour.create 1 |> Hour.toSeconds + x * current * time / 1.0 + + let toAmpereSeconds (x: float) = + let current = Ampere.create 1 + let time = Hour.create 1 |> Hour.toSeconds + x * current * time / 1.0 + + [] + module AmpereSecond = + + let create (x: float) = x * 1.0 + let toCoulombs (x: float) = x * 1.0 / 1.0 + + let toAmpereHours (x: float) = + let current = Ampere.create 1 + let time = Second.create 1 |> Second.toHours + x * current * time / 1.0 diff --git a/Fs.Units/Compound/ElectromotiveForce.fs b/src/Fs.Units/Compound/ElectromotiveForce.fs similarity index 72% rename from Fs.Units/Compound/ElectromotiveForce.fs rename to src/Fs.Units/Compound/ElectromotiveForce.fs index 2eadeab..968a03b 100644 --- a/Fs.Units/Compound/ElectromotiveForce.fs +++ b/src/Fs.Units/Compound/ElectromotiveForce.fs @@ -1,60 +1,67 @@ -namespace Fs.Units.ElectromotiveForce - -open Fs.Units - -module Units = - - /// Microvolt - [] type uV - - /// Millivolt - [] type mV - - /// Volt - [] type V = Energy.Units.J / ElectricCharge.Units.C - - /// Kilovolt - [] type kV - - /// Megavolt - [] type MV - -open Units - -module Microvolt = - +namespace Fs.Units + +[] +module ElectromotiveForce = + + /// Microvolt + [] + type uV + + /// Millivolt + [] + type mV + + /// Volt + [] + type V = J / C + + /// Kilovolt + [] + type kV + + /// Megavolt + [] + type MV + + [] + module Microvolt = + let create (x: float) = x * 1.0 let toMillivolts (x: float) = x * 1e-3 / 1.0 let toVolts (x: float) = x * 1e-6 / 1.0 let toKilovolts (x: float) = x * 1e-9 / 1.0 let toMegavolts (x: float) = x * 1e-12 / 1.0 - -module Millivolt = - + + [] + module Millivolt = + let create (x: float) = x * 1.0 let toMicrovolts (x: float) = x * 1e3 / 1.0 let toVolts (x: float) = x * 1e-3 / 1.0 let toKilovolts (x: float) = x * 1e-6 / 1.0 let toMegavolts (x: float) = x * 1e-9 / 1.0 - -module Volt = - + + [] + module Volt = + let create (x: float) = x * 1.0 let toMicrovolts (x: float) = x * 1e6 / 1.0 let toMillivolts (x: float) = x * 1e3 / 1.0 let toKilovolts (x: float) = x * 1e-3 / 1.0 let toMegavolts (x: float) = x * 1e-6 / 1.0 - -module Kilovolt = - + + [] + module Kilovolt = + let create (x: float) = x * 1.0 let toMicrovolts (x: float) = x * 1e9 / 1.0 let toMillivolts (x: float) = x * 1e6 / 1.0 let toVolts (x: float) = x * 1e3 / 1.0 let toMegavolts (x: float) = x * 1e-3 / 1.0 - -module Megavolt = - + + [] + module Megavolt = + let create (x: float) = x * 1.0 let toMicrovolts (x: float) = x * 1e12 / 1.0 let toMillivolts (x: float) = x * 1e9 / 1.0 diff --git a/Fs.Units/Compound/Energy.fs b/src/Fs.Units/Compound/Energy.fs similarity index 77% rename from Fs.Units/Compound/Energy.fs rename to src/Fs.Units/Compound/Energy.fs index 0b76ee7..2c00f62 100644 --- a/Fs.Units/Compound/Energy.fs +++ b/src/Fs.Units/Compound/Energy.fs @@ -1,82 +1,88 @@ -namespace Fs.Units.Energy - -open Fs.Units - -module Units = - - /// Joule - [] type J = Power.Units.W * Time.Units.s - - /// Kilojoule - [] type kJ = Power.Units.kW * Time.Units.s - - /// British thermal unit - [] type BTU - - /// calorie (not kilocalorie - Calorie) - [] type cal - - /// quad - [] type quad - - /// 1000 quads - [] type Q - -open Units - -module Joule = - +namespace Fs.Units + +[] +module Energy = + + /// Joule + [] + type J = W * s + + /// Kilojoule + [] + type kJ = kW * s + + /// British thermal unit + [] + type BTU + + /// calorie (not kilocalorie - Calorie) + [] + type cal + + /// quad + [] + type quad + + /// 1000 quads + [] + type Q + + [] + module Joule = + let create (x: float) = x * 1.0 let toKilojoules (x: float) = x * 1.0 / 1000.0 let toBritishThermalUnits (x: float) = x * 1.0 / 1055.06 let toCalories (x: float) = x * 1.0 / 4.184 let toQuads (x: float) = x * 1.0 / 1.055e+18 let toQs (x: float) = x * 1.0 / 1.055e+21 - -module Kilojoule = - + + [] + module Kilojoule = + let create (x: float) = x * 1.0 let toJoules (x: float) = x * 1000.0 / 1.0 let toBritishThermalUnits (x: float) = x * 1.0 / 1.05506 let toCalories (x: float) = x * 1000.0 / 4.184 let toQuads (x: float) = x * 1.0 / 1.055e+15 let toQs (x: float) = x * 1.0 / 1.055e+18 - -module BritishThermalUnit = - + + [] + module BritishThermalUnit = + let create (x: float) = x * 1.0 let toJoules (x: float) = x * 1055.06 / 1.0 let toKilojoules (x: float) = x * 1.05506 / 1.0 let toCalories (x: float) = x * 252.164 / 1.0 let toQuads (x: float) = x * 1e-15 / 1.0 let toQs (x: float) = x * 1.0 / 1.00e+18 - -module Calorie = - + + [] + module Calorie = + let create (x: float) = x * 1.0 let toJoules (x: float) = x * 4.184 / 1.0 let toKilojoules (x: float) = x * 4.184e-3 / 1.0 let toBritishThermalUnits (x: float) = x * 1.0 / 252.164 let toQuads (x: float) = x * 1.0 / 4.184e+21 let toQs (x: float) = x * 1.0 / 4.184e+24 - -module Quad = - + + [] + module Quad = + let create (x: float) = x * 1.0 let toJoules (x: float) = x * 1.055e+18 / 1.0 let toKilojoules (x: float) = x * 1.055e+15 / 1.0 let toBritishThermalUnits (x: float) = x * 1e+15 / 1.0 let toCalories (x: float) = x * 4.184e+21 / 1.0 let toQs (x: float) = x * 1e-3 / 1.0 - -module Q = - + + [] + module Q = + let create (x: float) = x * 1.0 let toJoules (x: float) = x * 1.055e+21 / 1.0 let toKilojoules (x: float) = x * 1.055e+18 / 1.0 let toBritishThermalUnits (x: float) = x * 1.00e+18 / 1.0 let toCalories (x: float) = x * 4.184e+24 / 1.0 let toQuads (x: float) = x * 1e+3 / 1.0 - - - diff --git a/src/Fs.Units/Compound/Force.fs b/src/Fs.Units/Compound/Force.fs new file mode 100644 index 0000000..748b362 --- /dev/null +++ b/src/Fs.Units/Compound/Force.fs @@ -0,0 +1,85 @@ +namespace Fs.Units + +[] +module Force = + + /// Newton + [] + type N = kg * m / (s * s) + + /// Pound force + [] + type lbf = lbm * ft / (s * s) + + /// Dyne + [] + type dyn = g * cm / (s * s) + + /// Kip + [] + type kip + + [] + module Newton = + + let create (x: float) = x * 1.0 + + let toPoundForce (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toPoundMass + let length = Meter.create 1 |> Meter.toFeet + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + let toDynes (x: float) = + let mass = Kilogram.create 1 |> Kilogram.toGrams + let length = Meter.create 1 |> Meter.toCentimeters + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + let toKips (x: float) = x * 2.24809e-4 / 1.0 + + [] + module PoundForce = + + let create (x: float) = x * 1.0 + + let toNewtons (x: float) = + let a = PoundMass.create 1 |> PoundMass.toKilograms + let b = Foot.create 1 |> Foot.toMeters + let time = Second.create 1 + x * a * b / time / time / 1.0 + + let toDynes (x: float) = + let mass = PoundMass.create 1 |> PoundMass.toGrams + let length = Foot.create 1 |> Foot.toCentimeters + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + let toKips (x: float) = x * 0.001 / 1.0 + + [] + module Dyne = + + let create (x: float) = x * 1.0 + + let toNewtons (x: float) = + let mass = Gram.create 1 |> Gram.toKilograms + let length = Centimeter.create 1 |> Centimeter.toMeters + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + let toPoundForce (x: float) = + let mass = Gram.create 1 |> Gram.toPoundMass + let length = Centimeter.create 1 |> Centimeter.toFeet + let time = Second.create 1 + x * mass * length / time / time / 1.0 + + let toKips (x: float) = x * 2.24809e-9 / 1.0 + + [] + module Kip = + + let create (x: float) = x * 1.0 + let toNewtons (x: float) = x * 1.0 / 2.24809e-4 + let toPoundForce (x: float) = x * 1.0 / 0.001 + let toDynes (x: float) = x * 1.0 / 2.24809e-9 diff --git a/src/Fs.Units/Compound/FuelEconomy.fs b/src/Fs.Units/Compound/FuelEconomy.fs new file mode 100644 index 0000000..725d5e3 --- /dev/null +++ b/src/Fs.Units/Compound/FuelEconomy.fs @@ -0,0 +1,24 @@ +namespace Fs.Units + +[] +module FuelEconomy = + + /// Kilometer per liter + [] + type kml = km / L + + /// Mile per gallon + [] + type mpg = mi / gal + + [] + module KilometerPerLiter = + + let create (x: float) = x * 1.0 + let toMilesPerGallon (x: float) = x * 2.35215 / 1.0 + + [] + module MilePerGallon = + + let create (x: float) = x * 1.0 + let toKilometersPerLiter (x: float) = x / 2.35215 * 1.0 diff --git a/Fs.Units/Compound/Inductance.fs b/src/Fs.Units/Compound/Inductance.fs similarity index 59% rename from Fs.Units/Compound/Inductance.fs rename to src/Fs.Units/Compound/Inductance.fs index 2218e94..546059f 100644 --- a/Fs.Units/Compound/Inductance.fs +++ b/src/Fs.Units/Compound/Inductance.fs @@ -1,33 +1,37 @@ -namespace Fs.Units.Inductance - -module Units = - - /// Microhenry - [] type uH - - /// Millihenry - [] type mH - - /// Henry - [] type H - -open Units - -module MicroHenry = - +namespace Fs.Units + +[] +module Inductance = + + /// Microhenry + [] + type uH + + /// Millihenry + [] + type mH + + /// Henry + [] + type H + + [] + module MicroHenry = + let create (x: float) = x * 1.0 let toMilliHenrys (x: float) = x * 1.0 / 1e+3 let toHenrys (x: float) = x * 1.0 / 1e+6 - -module MilliHenry = - + + [] + module MilliHenry = + let create (x: float) = x * 1.0 let toMicroHenrys (x: float) = x * 1.0 / 1e-3 let toHenrys (x: float) = x * 1.0 / 1e+3 - -module Henry = - + + [] + module Henry = + let create (x: float) = x * 1.0 let toMicroHenrys (x: float) = x * 1.0 / 1e-6 let toMilliHenrys (x: float) = x * 1.0 / 1e-3 - diff --git a/src/Fs.Units/Compound/Inertia.fs b/src/Fs.Units/Compound/Inertia.fs new file mode 100644 index 0000000..3182246 --- /dev/null +++ b/src/Fs.Units/Compound/Inertia.fs @@ -0,0 +1,28 @@ +namespace Fs.Units + +[] +module Inertia = + + [] + type in4 = inch * inch * inch * inch + + [] + type cm4 = cm * cm * cm * cm + + [] + module QuarticInch = + + let create (x: float) = x * 1.0 + + let toQuarticCentimeters (x: float) = + let length = Inch.create 1 |> Inch.toCentimeters + x * length * length * length * length / 1.0 + + [] + module QuarticCentimeter = + + let create (x: float) = x * 1.0 + + let toQuarticInches (x: float) = + let length = Centimeter.create 1 |> Centimeter.toInches + x * length * length * length * length / 1.0 diff --git a/Fs.Units/Compound/Power.fs b/src/Fs.Units/Compound/Power.fs similarity index 67% rename from Fs.Units/Compound/Power.fs rename to src/Fs.Units/Compound/Power.fs index 296225a..0b63529 100644 --- a/Fs.Units/Compound/Power.fs +++ b/src/Fs.Units/Compound/Power.fs @@ -1,48 +1,52 @@ -namespace Fs.Units.Power - -open Fs.Units - -module Units = - - /// Watt - [] type W = Force.Units.N * Length.Units.m / Time.Units.s - - /// Kilowatt - [] type kW - - /// Imperial horsepower - [] type hp - - /// Ton of refrigeration - [] type TR - -open Units - -module Watt = - +namespace Fs.Units + +[] +module Power = + + /// Watt + [] + type W = N * m / s + + /// Kilowatt + [] + type kW + + /// Imperial horsepower + [] + type hp + + /// Ton of refrigeration + [] + type TR + + [] + module Watt = + let create (x: float) = x * 1.0 let toKilowatts (x: float) = x * 1.0 / 1000.0 let toHorsepower (x: float) = x * 1.0 / 745.7 let toTonsOfRefrigeration (x: float) = x * 1.0 / 3516.85 - -module Kilowatt = + + [] + module Kilowatt = let create (x: float) = x * 1.0 let toWatts (x: float) = x * 1000.0 / 1.0 let toHorsepower (x: float) = x * 1000.0 / 745.7 let toTonsOfRefrigeration (x: float) = x * 1000.0 / 3516.85 - -module Horsepower = - + + [] + module Horsepower = + let create (x: float) = x * 1.0 let toWatts (x: float) = x * 745.7 / 1.0 let toKilowatts (x: float) = x * 745.7 / 1000.0 let toTonsOfRefrigeration (x: float) = x * 745.7 / 3516.85 - -module TonOfRefrigeration = - + + [] + module TonOfRefrigeration = + let create (x: float) = x * 1.0 let toWatts (x: float) = x * 3516.85 / 1.0 let toKilowatts (x: float) = x * 3516.85 / 1000.0 let toHorsepower (x: float) = x * 3516.85 / 745.7 - diff --git a/src/Fs.Units/Compound/Pressure.fs b/src/Fs.Units/Compound/Pressure.fs new file mode 100644 index 0000000..1a81da5 --- /dev/null +++ b/src/Fs.Units/Compound/Pressure.fs @@ -0,0 +1,32 @@ +namespace Fs.Units + +[] +module Pressure = + + /// Pascal + [] + type Pa = N / m2 + + /// Pounds per square inch + [] + type psi = lbf / in2 + + [] + module Pascal = + + let create (x: float) = x * 1.0 + + let toPoundsPerSquareInch (x: float) = + let force = Newton.create 1 |> Newton.toPoundForce + let length = Meter.create 1 |> Meter.toInches + x * force / length / length / 1.0 + + [] + module PoundPerSquareInch = + + let create (x: float) = x * 1.0 + + let toPascals (x: float) = + let force = PoundForce.create 1 |> PoundForce.toNewtons + let length = Inch.create 1 |> Inch.toMeters + x * force / length / length / 1.0 diff --git a/src/Fs.Units/Compound/Speed.fs b/src/Fs.Units/Compound/Speed.fs new file mode 100644 index 0000000..f9b55ee --- /dev/null +++ b/src/Fs.Units/Compound/Speed.fs @@ -0,0 +1,100 @@ +namespace Fs.Units + +[] +module Speed = + + /// Feet per second + [] + type fps = ft / s + + /// Meter per second + [] + type mps = m / s + + /// Kilometer per hour + [] + type kph = km / hr + + /// Mile per hour + [] + type mph = mi / hr + + [] + module FootPerSecond = + + let create (x: float) = x * 1.0 + + let toMetersPerSecond (x: float) = + let length = Foot.create 1 |> Foot.toMeters + let time = Second.create 1 + x * length / time / 1.0 + + let toKilometersPerHour (x: float) = + let length = Foot.create 1 |> Foot.toKilometers + let time = Second.create 1 |> Second.toHours + x * length / time / 1.0 + + let toMilesPerHour (x: float) = + let length = Foot.create 1 |> Foot.toMiles + let time = Second.create 1 |> Second.toHours + x * length / time / 1.0 + + [] + module MeterPerSecond = + + let create (x: float) = x * 1.0 + + let toFeetPerSecond (x: float) = + let length = Meter.create 1 |> Meter.toFeet + let time = Second.create 1 + x * length / time / 1.0 + + let toKilometersPerHour (x: float) = + let length = Meter.create 1 |> Meter.toKilometers + let time = Second.create 1 |> Second.toHours + x * length / time / 1.0 + + let toMilesPerHour (x: float) = + let length = Meter.create 1 |> Meter.toMiles + let time = Second.create 1 |> Second.toHours + x * length / time / 1.0 + + [] + module KilometerPerHour = + + let create (x: float) = x * 1.0 + + let toFeetPerSecond (x: float) = + let length = Kilometer.create 1 |> Kilometer.toFeet + let time = Hour.create 1 |> Hour.toSeconds + x * length / time / 1.0 + + let toMetersPerSecond (x: float) = + let length = Kilometer.create 1 |> Kilometer.toMeters + let time = Hour.create 1 |> Hour.toSeconds + x * length / time / 1.0 + + let toMilesPerHour (x: float) = + let length = Kilometer.create 1 |> Kilometer.toMiles + let time = Hour.create 1 + x * length / time / 1.0 + + [] + module MilePerHour = + + let create (x: float) = x * 1.0 + + let toFeetPerSecond (x: float) = + let length = Mile.create 1 |> Mile.toFeet + let time = Hour.create 1 |> Hour.toSeconds + x * length / time / 1.0 + + let toMetersPerSecond (x: float) = + let length = Mile.create 1 |> Mile.toMeters + let time = Hour.create 1 |> Hour.toSeconds + x * length / time / 1.0 + + let toKilometersPerHour (x: float) = + let length = Mile.create 1 |> Mile.toKilometers + let time = Hour.create 1 + x * length / time / 1.0 diff --git a/src/Fs.Units/Compound/Volume.fs b/src/Fs.Units/Compound/Volume.fs new file mode 100644 index 0000000..45a564e --- /dev/null +++ b/src/Fs.Units/Compound/Volume.fs @@ -0,0 +1,158 @@ +namespace Fs.Units + +[] +module Volume = + + /// Cubic inch + [] + type in3 = inch * inch * inch + + /// Cubic foot + [] + type ft3 = ft * ft * ft + + /// Cubic centimeter + [] + type cm3 = cm * cm * cm + + /// Cubic meter + [] + type m3 = m * m * m + + /// Liter (Litre) + [] + type L = dm * dm * dm + + /// Gallon + [] + type gal + + [] + module CubicInch = + + let create (x: float) = x * 1.0 + + let toCubicFeet (x: float) = + let length = Inch.create 1 |> Inch.toFeet + x * length * length * length / 1.0 + + let toCubicCentimeters (x: float) = + let length = Inch.create 1 |> Inch.toCentimeters + x * length * length * length / 1.0 + + let toCubicMeters (x: float) = + let length = Inch.create 1 |> Inch.toMeters + x * length * length * length / 1.0 + + let toLiters (x: float) : float = + let length = Inch.create 1 |> Inch.toDecimeters + x * length * length * length / 1.0 + + let toGallons (x: float) = 231. * (x / 1.0) + + [] + module CubicFoot = + + let create (x: float) = x * 1.0 + + let toCubicInches (x: float) = + let length = Foot.create 1 |> Foot.toInches + x * length * length * length / 1.0 + + let toCubicCentimeters (x: float) = + let length = Foot.create 1 |> Foot.toCentimeters + x * length * length * length / 1.0 + + let toCubicMeters (x: float) = + let length = Foot.create 1 |> Foot.toMeters + x * length * length * length / 1.0 + + let toLiters (x: float) : float = + let length = Foot.create 1 |> Foot.toDecimeters + x * length * length * length / 1.0 + + let toGallons (x: float) = 7.48052 * (x / 1.0) + + [] + module CubicCentimeter = + + let create (x: float) = x * 1.0 + + let toCubicInches (x: float) = + let length = Centimeter.create 1 |> Centimeter.toInches + x * length * length * length / 1.0 + + let toCubicFeet (x: float) = + let length = Centimeter.create 1 |> Centimeter.toFeet + x * length * length * length / 1.0 + + let toCubicMeters (x: float) = + let length = Centimeter.create 1 |> Centimeter.toMeters + x * length * length * length / 1.0 + + let toLiters (x: float) : float = + let length = Centimeter.create 1 |> Centimeter.toDecimeters + x * length * length * length / 1.0 + + let toGallons (x: float) = 1. * (x / 3785.4118) + + [] + module CubicMeter = + + let create (x: float) = x * 1.0 + + let toCubicInches (x: float) = + let length = Meter.create 1 |> Meter.toInches + x * length * length * length / 1.0 + + let toCubicFeet (x: float) = + let length = Meter.create 1 |> Meter.toFeet + x * length * length * length / 1.0 + + let toCubicCentimeters (x: float) = + let length = Meter.create 1 |> Meter.toCentimeters + x * length * length * length / 1.0 + + let toLiters (x: float) : float = + let length = Meter.create 1 |> Meter.toDecimeters + x * length * length * length / 1.0 + + let toGallons (x: float) = 264.172 * (x / 1.0) + + [] + module Liter = + + let create (x: float) = x * 1.0 + + let toCubicInches (x: float) = + let length = Decimeter.create 1 |> Decimeter.toInches + x * length * length * length / 1.0 + + let toCubicFeet (x: float) = + let length = Decimeter.create 1 |> Decimeter.toFeet + x * length * length * length / 1.0 + + let toCubicCentimeters (x: float) = + let length = Decimeter.create 1 |> Decimeter.toCentimeters + x * length * length * length / 1.0 + + let toCubicMeters (x: float) = + let length = Decimeter.create 1 |> Decimeter.toMeters + x * length * length * length / 1.0 + + let toGallons (x: float) = 0.264172 * (x / 1.0) + + [] + module Gallon = + + let create (x: float) = x * 1.0 + + let toCubicInches (x: float) = 1. * (x / 231.) + + let toCubicFeet (x: float) = 1. * (x / 7.48052) + + let toCubicCentimeters (x: float) = 3785.4118 * (x / 1.0) + + let toCubicMeters (x: float) = 1. * (x / 264.172) + + let toLiters (x: float) = 1. * (x / 0.264172) diff --git a/Fs.Units/Fs.Units.fsproj b/src/Fs.Units/Fs.Units.fsproj similarity index 87% rename from Fs.Units/Fs.Units.fsproj rename to src/Fs.Units/Fs.Units.fsproj index cfc967d..9f4d5c1 100644 --- a/Fs.Units/Fs.Units.fsproj +++ b/src/Fs.Units/Fs.Units.fsproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 true latest Fs.Units @@ -23,12 +23,12 @@ - + @@ -41,16 +41,20 @@ + + + - + True \ - + True \ - + + \ No newline at end of file diff --git a/src/Fs.Units/Helpers.fs b/src/Fs.Units/Helpers.fs new file mode 100644 index 0000000..c2d2191 --- /dev/null +++ b/src/Fs.Units/Helpers.fs @@ -0,0 +1,25 @@ +namespace Fs.Units + +open System + +module Helpers = + + let inline max (x: float<'Measure>) (y: float<'Measure>) = + Math.Max(float x, float y) |> LanguagePrimitives.FloatWithMeasure<'Measure> + + let inline min (x: float<'Measure>) (y: float<'Measure>) = + Math.Min(float x, float y) |> LanguagePrimitives.FloatWithMeasure<'Measure> + + let inline pow y (x: float<'Measure>) = Math.Pow(float x, float y) + + let inline pow2 (x: float<'Measure>) = + pow 2 x |> LanguagePrimitives.FloatWithMeasure<'Measure^2> + + let inline pow3 (x: float<'Measure>) = + pow 3 x |> LanguagePrimitives.FloatWithMeasure<'Measure^3> + + let inline pow4 (x: float<'Measure>) = + pow 4 x |> LanguagePrimitives.FloatWithMeasure<'Measure^4> + + let inline abs (x: float<'Measure>) = + Math.Abs(float x) |> LanguagePrimitives.FloatWithMeasure<'Measure> diff --git a/Fs.Units/Simple/Angle.fs b/src/Fs.Units/Simple/Angle.fs similarity index 59% rename from Fs.Units/Simple/Angle.fs rename to src/Fs.Units/Simple/Angle.fs index 45a18ee..e1d64f0 100644 --- a/Fs.Units/Simple/Angle.fs +++ b/src/Fs.Units/Simple/Angle.fs @@ -1,78 +1,108 @@ -namespace Fs.Units.Angle - -module Units = - - /// degree - [] type deg - - /// radian - [] type rad - - /// gradian - [] type grad - - /// revolution - [] type rev - - /// arc-minute - [] type arcmin - - /// arc-second - [] type arcs - -open Units +namespace Fs.Units + open System -module Degree = - +[] +module Angle = + + /// degree + [] + type deg + + /// radian + [] + type rad + + /// gradian + [] + type grad + + /// revolution + [] + type rev + + /// arc-minute + [] + type arcmin + + /// arc-second + [] + type arcs + + [] + module Degree = + let create (x: float) = x * 1.0 let toRadians (x: float) = x * Math.PI * 1.0 / 180.0 - let toGradians (x: float) = x * (200.0/180.0) * 1.0 / 1.0 + + let toGradians (x: float) = + x * (200.0 / 180.0) * 1.0 / 1.0 + let toRevolutions (x: float) = x * 1.0 / 360.0 let toArcMinutes (x: float) = x * 60.0 / 1.0 let toArcSeconds (x: float) = x * 3600.0 / 1.0 - -module Radian = - + + [] + module Radian = + let create (x: float) = x * 1.0 let toDegrees (x: float) = x * 180.0 / (Math.PI * 1.0) let toGradians (x: float) = x * 200.0 / (Math.PI * 1.0) - let toRevolutions (x: float) = x * 1.0 / (2.0 * Math.PI * 1.0) - let toArcMinutes (x: float) = x * 60.0 * 180.0 / Math.PI / 1.0 - let toArcSeconds (x: float) = x * 3600.0 * 180.0 / Math.PI / 1.0 - -module Gradian = - + + let toRevolutions (x: float) = + x * 1.0 / (2.0 * Math.PI * 1.0) + + let toArcMinutes (x: float) = + x * 60.0 * 180.0 / Math.PI / 1.0 + + let toArcSeconds (x: float) = + x * 3600.0 * 180.0 / Math.PI / 1.0 + + [] + module Gradian = + let create (x: float) = x * 1.0 - let toDegrees (x: float) = x * 1.0 / (200.0/180.0) / 1.0 + + let toDegrees (x: float) = + x * 1.0 / (200.0 / 180.0) / 1.0 + let toRadians (x: float) = x * Math.PI * 1.0 / 200.0 let toRevolutions (x: float) = x * 1.0 / 400.0 let toArcMinutes (x: float) = x * 54.0 / 1.0 let toArcSeconds (x: float) = x * 3240.0 / 1.0 - -module Revolution = - + + [] + module Revolution = + let create (x: float) = x * 1.0 let toDegrees (x: float) = x * 360.0 / 1.0 let toRadians (x: float) = x * 2.0 * Math.PI * 1.0 / 1.0 let toGradians (x: float) = x * 400.0 / 1.0 let toArcMinutes (x: float) = x * 21600.0 / 1.0 let toArcSeconds (x: float) = x * 1296000.0 / 1.0 - -module ArcMinute = + + [] + module ArcMinute = let create (x: float) = x * 1.0 let toDegrees (x: float) = x * 1.0 / 60.0 - let toRadians (x: float) = x * Math.PI * 1.0 / (180.0 * 60.0) / 1.0 + + let toRadians (x: float) = + x * Math.PI * 1.0 / (180.0 * 60.0) / 1.0 + let toGradians (x: float) = x * 1.0 / 54.0 let toRevolutions (x: float) = x * 1.0 / 21600.0 let toArcSeconds (x: float) = x * 60.0 / 1.0 -module ArcSecond = + [] + module ArcSecond = let create (x: float) = x * 1.0 let toDegrees (x: float) = x * 1.0 / 3600.0 - let toRadians (x: float) = x * Math.PI * 1.0 / (180.0 * 3600.0) / 1.0 + + let toRadians (x: float) = + x * Math.PI * 1.0 / (180.0 * 3600.0) / 1.0 + let toGradians (x: float) = x * 1.0 / 3240.0 let toRevolutions (x: float) = x * 1.0 / 1296000.0 - let toArcMinutes (x: float) = x * 1.0 / 60.0 \ No newline at end of file + let toArcMinutes (x: float) = x * 1.0 / 60.0 diff --git a/Fs.Units/Simple/Current.fs b/src/Fs.Units/Simple/Current.fs similarity index 68% rename from Fs.Units/Simple/Current.fs rename to src/Fs.Units/Simple/Current.fs index 03b0de9..813378e 100644 --- a/Fs.Units/Simple/Current.fs +++ b/src/Fs.Units/Simple/Current.fs @@ -1,46 +1,52 @@ -namespace Fs.Units.Current - -module Units = - - /// Microampere - [] type uA - - /// Milliampere - [] type mA - - /// Ampere - [] type A - - /// biot - [] type biot - -open Units - -module Microampere = - +namespace Fs.Units + +[] +module Current = + + /// Microampere + [] + type uA + + /// Milliampere + [] + type mA + + /// Ampere + [] + type A + + /// biot + [] + type biot + + [] + module Microampere = + let create (x: float) = x * 1.0 let toAmperes (x: float) = x * 1e6
/ 1.0 let toMilliamperes (x: float) = x * 1e3 / 1.0 let toBiots (x: float) = x * 1e-7 / 1.0 - -module Milliampere = - + + [] + module Milliampere = + let create (x: float) = x * 1.0 let toAmperes (x: float) = x * 1e3 / 1.0 let toMicroamperes (x: float) = x * 1e-3 / 1.0 let toBiots (x: float) = x * 1e-4 / 1.0 - -module Ampere = - + + [] + module Ampere = + let create (x: float) = x * 1.0 let toMilliamperes (x: float) = x * 1e-3 / 1.0 let toMicroamperes (x: float) = x * 1e-6 / 1.0 let toBiots (x: float) = x * 0.1 / 1.0 -module Biot = - + [] + module Biot = + let create (x: float) = x * 1.0 let toAmperes (x: float) = x * 10.0 / 1.0 let toMilliamperes (x: float) = x * 1e+4 / 1.0 let toMicroamperes (x: float) = x * 1e+7 / 1.0 - \ No newline at end of file diff --git a/Fs.Units/Simple/DataStorage.fs b/src/Fs.Units/Simple/DataStorage.fs similarity index 88% rename from Fs.Units/Simple/DataStorage.fs rename to src/Fs.Units/Simple/DataStorage.fs index 2920cc3..87f4f76 100644 --- a/Fs.Units/Simple/DataStorage.fs +++ b/src/Fs.Units/Simple/DataStorage.fs @@ -1,47 +1,59 @@ -namespace Fs.Units.DataStorage - -module Units = - - /// Bit - [] type b - - /// Kilobit - [] type kb - - /// Megabit - [] type Mb - - /// Gigabit - [] type Gb - - /// Terabit - [] type Tb - - /// Petabit - [] type Pb - - /// Byte - [] type B - - /// Kilobyte - [] type kB - - /// Megabyte - [] type MB - - /// Gigabyte - [] type GB - - /// Terabyte - [] type TB - - /// Petabyte - [] type PB - -open Units - -module Bit = - +namespace Fs.Units + +[] +module DataStorage = + + /// Bit + [] + type b + + /// Kilobit + [] + type kb + + /// Megabit + [] + type Mb + + /// Gigabit + [] + type Gb + + /// Terabit + [] + type Tb + + /// Petabit + [] + type Pb + + /// Byte + [] + type B + + /// Kilobyte + [] + type kB + + /// Megabyte + [] + type MB + + /// Gigabyte + [] + type GB + + /// Terabyte + [] + type TB + + /// Petabyte + [] + type PB + + [] + module Bit = + let create (x: float) = x * 1.0 let toKilobits (x: float) = x / 1e+3 * 1.0 let toMegabits (x: float) = x / 1e+6 * 1.0 @@ -54,9 +66,10 @@ module Bit = let toGigabytes (x: float) = x / 8.0e+9 * 1.0 let toTerabytes (x: float) = x / 8.0e+12 * 1.0 let toPetabytes (x: float) = x / 8.0e+15 * 1.0 - -module Kilobit = - + + [] + module Kilobit = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 1e+3 / 1.0 let toMegabits (x: float) = x / 1e+3 * 1.0 @@ -69,9 +82,10 @@ module Kilobit = let toGigabytes (x: float) = x / 8.0e+6 * 1.0 let toTerabytes (x: float) = x / 8.0e+9 * 1.0 let toPetabytes (x: float) = x / 8.0e+12 * 1.0 - -module Megabit = - + + [] + module Megabit = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 1e+6 / 1.0 let toKilobits (x: float) = x * 1e+3 / 1.0 @@ -84,9 +98,10 @@ module Megabit = let toGigabytes (x: float) = x / 8.0e+3 * 1.0 let toTerabytes (x: float) = x / 8.0e+6 * 1.0 let toPetabytes (x: float) = x / 8.0e+9 * 1.0 - -module Gigabit = - + + [] + module Gigabit = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 1e+9 / 1.0 let toKilobits (x: float) = x * 1e+6 / 1.0 @@ -99,9 +114,10 @@ module Gigabit = let toGigabytes (x: float) = x / 8.0 * 1.0 let toTerabytes (x: float) = x / 8.0e+3 * 1.0 let toPetabytes (x: float) = x / 8.0e+6 * 1.0 - -module Terabit = - + + [] + module Terabit = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 1e+12 / 1.0 let toKilobits (x: float) = x * 1e+9 / 1.0 @@ -114,9 +130,10 @@ module Terabit = let toGigabytes (x: float) = x * 125.0 / 1.0 let toTerabytes (x: float) = x / 8.0 * 1.0 let toPetabytes (x: float) = x / 8.0e+3 * 1.0 - -module Petabit = - + + [] + module Petabit = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 1e+15 / 1.0 let toKilobits (x: float) = x * 1e+12 / 1.0 @@ -129,9 +146,10 @@ module Petabit = let toGigabytes (x: float) = x * 1.25e+5 / 1.0 let toTerabytes (x: float) = x * 125.0 / 1.0 let toPetabytes (x: float) = x / 8.0 * 1.0 - -module Byte = - + + [] + module Byte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8.0 / 1.0 let toKilobits (x: float) = x * 8e-3 / 1.0 @@ -144,9 +162,10 @@ module Byte = let toGigabytes (x: float) = x * 1e-9 / 1.0 let toTerabytes (x: float) = x * 1e-12 / 1.0 let toPetabytes (x: float) = x * 1e-15 / 1.0 - -module Kilobyte = - + + [] + module Kilobyte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8e+3 / 1.0 let toKilobits (x: float) = x * 8.0 / 1.0 @@ -159,9 +178,10 @@ module Kilobyte = let toGigabytes (x: float) = x * 1e-6 / 1.0 let toTerabytes (x: float) = x * 1e-9 / 1.0 let toPetabytes (x: float) = x * 1e-12 / 1.0 - -module Megabyte = - + + [] + module Megabyte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8e+6 / 1.0 let toKilobits (x: float) = x * 8e+3 / 1.0 @@ -174,9 +194,10 @@ module Megabyte = let toGigabytes (x: float) = x * 1e-3 / 1.0 let toTerabytes (x: float) = x * 1e-6 / 1.0 let toPetabytes (x: float) = x * 1e-9 / 1.0 - -module Gigabyte = - + + [] + module Gigabyte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8e+9 / 1.0 let toKilobits (x: float) = x * 8e+6 / 1.0 @@ -189,9 +210,10 @@ module Gigabyte = let toMegabytes (x: float) = x * 1e+3 / 1.0 let toTerabytes (x: float) = x * 1e-3 / 1.0 let toPetabytes (x: float) = x * 1e-6 / 1.0 - -module Terabyte = - + + [] + module Terabyte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8e+12 / 1.0 let toKilobits (x: float) = x * 8e+9 / 1.0 @@ -204,9 +226,10 @@ module Terabyte = let toMegabytes (x: float) = x * 1e+6 / 1.0 let toGigabytes (x: float) = x * 1e+3 / 1.0 let toPetabytes (x: float) = x * 1e-3 / 1.0 - -module Petabyte = - + + [] + module Petabyte = + let create (x: float) = x * 1.0 let toBits (x: float) = x * 8e+15 / 1.0 let toKilobits (x: float) = x * 8e+12 / 1.0 diff --git a/Fs.Units/Simple/Frequency.fs b/src/Fs.Units/Simple/Frequency.fs similarity index 68% rename from Fs.Units/Simple/Frequency.fs rename to src/Fs.Units/Simple/Frequency.fs index f3d27a2..2f8f532 100644 --- a/Fs.Units/Simple/Frequency.fs +++ b/src/Fs.Units/Simple/Frequency.fs @@ -1,46 +1,52 @@ -namespace Fs.Units.Frequency - -module Units = - - /// Hertz - [] type Hz - - /// Kilohertz - [] type kHz - - /// Megahertz - [] type MHz - - /// Gigahertz - [] type GHz - -open Units - -module Hertz = - +namespace Fs.Units + +[] +module Frequency = + + /// Hertz + [] + type Hz + + /// Kilohertz + [] + type kHz + + /// Megahertz + [] + type MHz + + /// Gigahertz + [] + type GHz + + [] + module Hertz = + let create (x: float) = x * 1.0 let toKilohertz (x: float) = x / 1e+3 * 1.0 let toMegahertz (x: float) = x / 1e+6 * 1.0 let toGigahertz (x: float) = x / 1e+9 * 1.0 - -module Kilohertz = - + + [] + module Kilohertz = + let create (x: float) = x * 1.0 let toHertz (x: float) = x * 1e+3 / 1.0 let toMegahertz (x: float) = x / 1e+3 * 1.0 let toGigahertz (x: float) = x / 1e+6 * 1.0 - -module Megahertz = - + + [] + module Megahertz = + let create (x: float) = x * 1.0 let toHertz (x: float) = x * 1e+6 / 1.0 let toKilohertz (x: float) = x * 1e+3 / 1.0 let toGigahertz (x: float) = x / 1e+3 * 1.0 - -module Gigahertz = - + + [] + module Gigahertz = + let create (x: float) = x * 1.0 let toHertz (x: float) = x * 1e+9 / 1.0 let toKilohertz (x: float) = x * 1e+6 / 1.0 let toMegahertz (x: float) = x * 1e+3 / 1.0 - \ No newline at end of file diff --git a/Fs.Units/Simple/Illuminance.fs b/src/Fs.Units/Simple/Illuminance.fs similarity index 64% rename from Fs.Units/Simple/Illuminance.fs rename to src/Fs.Units/Simple/Illuminance.fs index b8e178e..428a870 100644 --- a/Fs.Units/Simple/Illuminance.fs +++ b/src/Fs.Units/Simple/Illuminance.fs @@ -1,45 +1,52 @@ -namespace Fs.Units.Illuminance - -module private Units = - - /// Footcandle - [] type fc - - /// Lux - [] type lx - - /// Phot - [] type ph - - /// Nox - [] type nox - -open Units - -module Footcandle = - +namespace Fs.Units + +[] +module Illuminance = + + /// Footcandle + [] + type fc + + /// Lux + [] + type lx + + /// Phot + [] + type ph + + /// Nox + [] + type nox + + [] + module Footcandle = + let create (x: float) = x * 1.0 let toLux (x: float) = x * 10.7639 / 1.0 let toPhot (x: float) = x / 929.03 * 1.0 let toNox (x: float) = x * 10763.9104167 / 1.0 - -module Lux = - + + [] + module Lux = + let create (x: float) = x * 1.0 let toFootcandle (x: float) = x * 1.0 / 10.7639 let toPhot (x: float) = x * 0.0001 / 1.0 let toNox (x: float) = x * 1000.0 / 1.0 - -module Phot = - + + [] + module Phot = + let create (x: float) = x * 1.0 let toFootcandle (x: float) = x * 929.03 / 1.0 let toLux (x: float) = x * 1e+4 / 1.0 let toNox (x: float) = x * 1e+7 / 1.0 - -module Nox = - + + [] + module Nox = + let create (x: float) = x * 1.0 let toFootcandle (x: float) = x * 1.0 / 10763.9104167 let toLux (x: float) = x * 1.0 / 1e+3 - let toPhot (x: float) = x * 1.0 / 1e+7 \ No newline at end of file + let toPhot (x: float) = x * 1.0 / 1e+7 diff --git a/Fs.Units/Simple/Length.fs b/src/Fs.Units/Simple/Length.fs similarity index 78% rename from Fs.Units/Simple/Length.fs rename to src/Fs.Units/Simple/Length.fs index e8f3a5f..86ede06 100644 --- a/Fs.Units/Simple/Length.fs +++ b/src/Fs.Units/Simple/Length.fs @@ -1,59 +1,78 @@ -namespace Fs.Units.Length - -module Units = - - /// Inch - [] type inch - - /// Foot - [] type ft - - /// Yard - [] type yd - - /// Mile - [] type mi - - /// Millimeter - [] type mm - - /// Centimeter - [] type cm - - /// Meter - [] type m - - /// Kilometer - [] type km - - /// Nautical mile - [] type nmi - - /// chain - [] type chain - - /// furlong - [] type fur - - /// league - [] type league - - /// hand - [] type hand - - /// rod - [] type rd - -open Units - -module Inch = - +namespace Fs.Units + +[] +module Length = + + /// Inch + [] + type inch + + /// Foot + [] + type ft + + /// Yard + [] + type yd + + /// Mile + [] + type mi + + /// Millimeter + [] + type mm + + /// Centimeter + [] + type cm + + /// Decimeter + [] + type dm + + /// Meter + [] + type m + + /// Kilometer + [] + type km + + /// Nautical mile + [] + type nmi + + /// chain + [] + type chain + + /// furlong + [] + type fur + + /// league + [] + type league + + /// hand + [] + type hand + + /// rod + [] + type rd + + [] + module Inch = + let create (x: float) = x * 1.0 let toFeet (x: float) = x / 12.0 * 1.0 let toYards (x: float) = x / 36.0 * 1.0 let toMiles (x: float) = x / 63360.0 * 1.0 let toMillimeters (x: float) = x * 25.4 / 1.0 let toCentimeters (x: float) = x * 2.54 / 1.0 + let toDecimeters (x: float) = x * 0.254 / 1.0 let toMeters (x: float) = x * 0.0254 / 1.0 let toKilometers (x: float) = x * 0.0000254 / 1.0 let toNauticalMiles (x: float) = x * 0.0000137 / 1.0 @@ -62,15 +81,17 @@ module Inch = let toLeagues (x: float) = x * 4.5716e-6 / 1.0 let toHands (x: float) = x * 0.25 / 1.0 let toRods (x: float) = x * 0.00505051 / 1.0 - -module Foot = - + + [] + module Foot = + let create (x: float) = x * 1.0 let toInches (x: float) = x * 12.0 / 1.0 let toYards (x: float) = x / 3.0 * 1.0 let toMiles (x: float) = x / 5280.0 * 1.0 let toMillimeters (x: float) = x * 304.8 / 1.0 let toCentimeters (x: float) = x * 30.48 / 1.0 + let toDecimeters (x: float) = x * 3.048 / 1.0 let toMeters (x: float) = x * 0.3048 / 1.0 let toKilometers (x: float) = x * 0.0003048 / 1.0 let toNauticalMiles (x: float) = x * 0.000164579 / 1.0 @@ -79,15 +100,17 @@ module Foot = let toLeagues (x: float) = x * 5.48596e-5 / 1.0 let toHands (x: float) = x * 3.0 / 1.0 let toRods (x: float) = x * 0.0606061 / 1.0 - -module Yard = - + + [] + module Yard = + let create (x: float) = x * 1.0 let toInches (x: float) = x * 36.0 / 1.0 let toFeet (x: float) = x * 3.0 / 1.0 let toMiles (x: float) = x / 1760.0 * 1.0 let toMillimeters (x: float) = x * 914.4 / 1.0 let toCentimeters (x: float) = x * 91.44 / 1.0 + let toDecimeters (x: float) = x * 9.144 / 1.0 let toMeters (x: float) = x * 0.9144 / 1.0 let toKilometers (x: float) = x * 0.0009144 / 1.0 let toNauticalMiles (x: float) = x / 2025.37 * 1.0 @@ -96,15 +119,17 @@ module Yard = let toLeagues (x: float) = x / 5280.0 * 1.0 let toHands (x: float) = x * 1.0 / 0.111111 let toRods (x: float) = x / 5.5 * 1.0 - -module Mile = - + + [] + module Mile = + let create (x: float) = x * 1.0 let toInches (x: float) = x * 63360.0 / 1.0 let toFeet (x: float) = x * 5280.0 / 1.0 let toYards (x: float) = x * 1760.0 / 1.0 let toMillimeters (x: float) = x * 1609344.0 / 1.0 let toCentimeters (x: float) = x * 160934.4 / 1.0 + let toDecimeters (x: float) = x * 16093.44 / 1.0 let toMeters (x: float) = x * 1609.344 / 1.0 let toKilometers (x: float) = x * 1.609344 / 1.0 let toNauticalMiles (x: float) = x / 1.15078 * 1.0 @@ -113,15 +138,17 @@ module Mile = let toLeagues (x: float) = x / 3.0 * 1.0 let toHands (x: float) = x * 1.0 / 6.31313e-5 let toRods (x: float) = x * 1.0 / 0.003125 - -module Millimeter = - + + [] + module Millimeter = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 25.4 * 1.0 let toFeet (x: float) = x / 304.8 * 1.0 let toYards (x: float) = x / 914.4 * 1.0 let toMiles (x: float) = x / 1609344.0 * 1.0 let toCentimeters (x: float) = x / 10.0 * 1.0 + let toDecimeters (x: float) = x / 100.0 * 1.0 let toMeters (x: float) = x / 1000.0 * 1.0 let toKilometers (x: float) = x / 1000000.0 * 1.0 let toNauticalMiles (x: float) = x / 1852000.0 * 1.0 @@ -130,15 +157,17 @@ module Millimeter = let toLeagues (x: float) = x / 4.828e+6 * 1.0 let toHands (x: float) = x / 101.6 * 1.0 let toRods (x: float) = x / 5029.2 * 1.0 - -module Centimeter = - + + [] + module Centimeter = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 2.54 * 1.0 let toFeet (x: float) = x / 30.48 * 1.0 let toYards (x: float) = x / 91.44 * 1.0 let toMiles (x: float) = x / 160934.4 * 1.0 let toMillimeters (x: float) = x / 0.1 * 1.0 + let toDecimeters (x: float) = x / 10.0 * 1.0 let toMeters (x: float) = x / 100.0 * 1.0 let toKilometers (x: float) = x / 100000.0 * 1.0 let toNauticalMiles (x: float) = x / 185200.0 * 1.0 @@ -148,15 +177,36 @@ module Centimeter = let toHands (x: float) = x / 10.16 * 1.0 let toRods (x: float) = x / 502.92 * 1.0 -module Meter = - + [] + module Decimeter = + + let create (x: float) = x * 1.0 + let toInches (x: float) = x / 0.254 * 1.0 + let toFeet (x: float) = x / 3.048 * 1.0 + let toYards (x: float) = x / 9.144 * 1.0 + let toMiles (x: float) = x / 16093.44 * 1.0 + let toMillimeters (x: float) = x / 0.01 * 1.0 + let toCentimeters (x: float) = x / 0.1 * 1.0 + let toMeters (x: float) = x / 10.0 * 1.0 + let toKilometers (x: float) = x / 10000.0 * 1.0 + let toNauticalMiles (x: float) = x / 18520.0 * 1.0 + let toChains (x: float) = x / 20.1168 * 1.0 + let toFurlongs (x: float) = x / 2011.68 * 1.0 + let toLeagues (x: float) = x / 48280.32 * 1.0 + let toHands (x: float) = x / 1.016 * 1.0 + let toRods (x: float) = x / 50.292 * 1.0 + + [] + module Meter = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 0.0254 * 1.0 - let toCentimeters (x: float) = x * 100.0 / 1.0 let toFeet (x: float) = x / 0.3048 * 1.0 let toYards (x: float) = x / 0.9144 * 1.0 let toMiles (x: float) = x / 1609.344 * 1.0 let toMillimeters (x: float) = x * 1000.0 / 1.0 + let toCentimeters (x: float) = x * 100.0 / 1.0 + let toDecimeters (x: float) = x * 10.0 / 1.0 let toKilometers (x: float) = x / 1000.0 * 1.0 let toNauticalMiles (x: float) = x / 1852.0 * 1.0 let toChains (x: float) = x / 20.1168 * 1.0 @@ -164,12 +214,14 @@ module Meter = let toLeagues (x: float) = x / 4828.032 * 1.0 let toHands (x: float) = x / 0.1016 * 1.0 let toRods (x: float) = x / 5.0292 * 1.0 - -module Kilometer = - + + [] + module Kilometer = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 0.0000254 * 1.0 let toCentimeters (x: float) = x * 100000.0 / 1.0 + let toDecimeters (x: float) = x * 10000.0 / 1.0 let toFeet (x: float) = x / 0.0003048 * 1.0 let toYards (x: float) = x / 0.0009144 * 1.0 let toMiles (x: float) = x / 1.609344 * 1.0 @@ -181,12 +233,14 @@ module Kilometer = let toLeagues (x: float) = x / 4.828032 * 1.0 let toHands (x: float) = x / 0.0001016 * 1.0 let toRods (x: float) = x / 0.0050292 * 1.0 - -module NauticalMile = - + + [] + module NauticalMile = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 0.0000137 * 1.0 let toCentimeters (x: float) = x * 185200.0 / 1.0 + let toDecimeters (x: float) = x * 18520.0 / 1.0 let toFeet (x: float) = x / 0.000164579 * 1.0 let toYards (x: float) = x * 2025.37 / 1.0 let toMiles (x: float) = x * 1.15078 / 1.0 @@ -198,16 +252,18 @@ module NauticalMile = let toLeagues (x: float) = x / 0.000889984 * 1.0 let toHands (x: float) = x / 0.0000546807 * 1.0 let toRods (x: float) = x * 368.249 / 1.0 - -module Chain = - + + [] + module Chain = + let create (x: float) = x * 1.0 - let toInches (x: float) = x / 0.00126263 * 1.0 + let toInches (x: float) = x / 0.00126263 * 1.0 let toFeet (x: float) = x / 0.0151515 * 1.0 let toYards (x: float) = x * 22.0 / 1.0 let toMiles (x: float) = x / 80.0 * 1.0 let toMillimeters (x: float) = x * 20116.8 / 1.0 let toCentimeters (x: float) = x * 201.168 / 1.0 + let toDecimeters (x: float) = x * 20.1168 / 1.0 let toMeters (x: float) = x * 20.1168 / 1.0 let toKilometers (x: float) = x * 0.0201168 / 1.0 let toNauticalMiles (x: float) = x * 0.0000373265 / 1.0 @@ -215,16 +271,18 @@ module Chain = let toLeagues (x: float) = x / 0.00889984 * 1.0 let toHands (x: float) = x / 0.000493737 * 1.0 let toRods (x: float) = x / 0.0000905213 * 1.0 - -module Furlong = - + + [] + module Furlong = + let create (x: float) = x * 1.0 - let toInches (x: float) = x / 0.000126262 * 1.0 + let toInches (x: float) = x / 0.000126262 * 1.0 let toFeet (x: float) = x / 0.00151515 * 1.0 let toYards (x: float) = x * 220.0 / 1.0 let toMiles (x: float) = x / 8.0 * 1.0 let toMillimeters (x: float) = x * 201168.0 / 1.0 let toCentimeters (x: float) = x * 20116.8 / 1.0 + let toDecimeters (x: float) = x * 2011.68 / 1.0 let toMeters (x: float) = x * 201.168 / 1.0 let toKilometers (x: float) = x * 0.201168 / 1.0 let toNauticalMiles (x: float) = x * 0.000373266 / 1.0 @@ -232,16 +290,18 @@ module Furlong = let toLeagues (x: float) = x / 0.000889984 * 1.0 let toHands (x: float) = x / 0.0000493737 * 1.0 let toRods (x: float) = x / 0.00000905213 * 1.0 - -module League = - + + [] + module League = + let create (x: float) = x * 1.0 - let toInches (x: float) = x / 4.5716e-6 * 1.0 + let toInches (x: float) = x / 4.5716e-6 * 1.0 let toFeet (x: float) = x / 5.48596e-5 * 1.0 let toYards (x: float) = x * 5280.0 / 1.0 let toMiles (x: float) = x * 3.0 / 1.0 let toMillimeters (x: float) = x * 4.828e+6 / 1.0 let toCentimeters (x: float) = x * 482803.2 / 1.0 + let toDecimeters (x: float) = x * 48280.32 / 1.0 let toMeters (x: float) = x * 4828.032 / 1.0 let toKilometers (x: float) = x * 4.828032 / 1.0 let toNauticalMiles (x: float) = x * 0.000889984 / 1.0 @@ -249,16 +309,18 @@ module League = let toFurlongs (x: float) = x * 0.000889984 / 1.0 let toHands (x: float) = x / 0.00000493737 * 1.0 let toRods (x: float) = x / 0.000000905213 * 1.0 - -module Hand = - + + [] + module Hand = + let create (x: float) = x * 1.0 - let toInches (x: float) = x / 0.25 * 1.0 + let toInches (x: float) = x / 0.25 * 1.0 let toFeet (x: float) = x / 3.0 * 1.0 let toYards (x: float) = x * 0.111111 / 1.0 let toMiles (x: float) = x * 6.31313e-5 / 1.0 let toMillimeters (x: float) = x * 101.6 / 1.0 let toCentimeters (x: float) = x * 10.16 / 1.0 + let toDecimeters (x: float) = x * 1.016 / 1.0 let toMeters (x: float) = x * 0.1016 / 1.0 let toKilometers (x: float) = x * 0.0001016 / 1.0 let toNauticalMiles (x: float) = x * 0.0000546807 / 1.0 @@ -266,9 +328,10 @@ module Hand = let toFurlongs (x: float) = x * 0.0000493737 / 1.0 let toLeagues (x: float) = x * 0.00000493737 / 1.0 let toRods (x: float) = x / 0.00000446429 * 1.0 - -module Rod = - + + [] + module Rod = + let create (x: float) = x * 1.0 let toInches (x: float) = x / 0.00505051 * 1.0 let toFeet (x: float) = x / 0.0606061 * 1.0 @@ -276,6 +339,7 @@ module Rod = let toMiles (x: float) = x * 0.003125 / 1.0 let toMillimeters (x: float) = x * 5029.2 / 1.0 let toCentimeters (x: float) = x * 502.92 / 1.0 + let toDecimeters (x: float) = x * 50.292 / 1.0 let toMeters (x: float) = x * 5.0292 / 1.0 let toKilometers (x: float) = x * 0.0050292 / 1.0 let toNauticalMiles (x: float) = x * 1.0 / 368.249 diff --git a/Fs.Units/Simple/Mass.fs b/src/Fs.Units/Simple/Mass.fs similarity index 60% rename from Fs.Units/Simple/Mass.fs rename to src/Fs.Units/Simple/Mass.fs index 03ee3cd..be63719 100644 --- a/Fs.Units/Simple/Mass.fs +++ b/src/Fs.Units/Simple/Mass.fs @@ -1,44 +1,51 @@ -namespace Fs.Units.Mass - -module Units = - - /// Milligram - [] type mg - - /// Gram - [] type g - - /// Kilogram - [] type kg - - /// Pound mass - [] type lbm - -open Units - -module Milligram = - +namespace Fs.Units + +[] +module Mass = + + /// Milligram + [] + type mg + + /// Gram + [] + type g + + /// Kilogram + [] + type kg + + /// Pound mass + [] + type lbm + + [] + module Milligram = + let create (x: float) = x * 1.0 let toKilograms (x: float) = x * 1e-6 / 1.0 let toGrams (x: float) = x * 1e-3 / 1.0 let toPoundMass (x: float) = x * 1.0 / 453592.0 - -module Gram = - - let create (x: float) = x * 1.0 + + [] + module Gram = + + let create (x: float) = x * 1.0 let toMilligrams (x: float) = x * 1e3 / 1.0 let toKilograms (x: float) = x * 1e-3 / 1.0 - let toPoundMass (x: float) = x *1.0 / 453.592 - -module Kilogram = - + let toPoundMass (x: float) = x * 1.0 / 453.592 + + [] + module Kilogram = + let create (x: float) = x * 1.0 let toMilligrams (x: float) = x * 1e6 / 1.0 let toGrams (x: float) = x * 1e3 / 1.0 let toPoundMass (x: float) = x * 2.20462 / 1.0 - -module PoundMass = - + + [] + module PoundMass = + let create (x: float) = x * 1.0 let toMilligrams (x: float) = x * 453592.0 / 1.0 let toGrams (x: float) = x * 453.592 / 1.0 diff --git a/src/Fs.Units/Simple/Temperature.fs b/src/Fs.Units/Simple/Temperature.fs new file mode 100644 index 0000000..007576d --- /dev/null +++ b/src/Fs.Units/Simple/Temperature.fs @@ -0,0 +1,67 @@ +namespace Fs.Units + +[] +module Temperature = + + /// Kelvin + [] + type K + + /// Celsius + [] + type C + + /// Fahrenheit + [] + type F + + /// Rankine + [] + type R + + [] + module Kelvin = + + let create (x: float) = x * 1.0 + let toCelsius (x: float) = (x - 273.15) / 1.0 * 1.0 + + let toFahrenheit (x: float) = + ((x - 273.15) * (9.0 / 5.0) + 32.0) / 1.0 * 1.0 + + let toRankine (x: float) = (x * 1.8) / 1.0 * 1.0 + + [] + module Celsius = + + let create (x: float) = x * 1.0 + let toKelvin (x: float) = (x + 273.15) / 1.0 * 1.0 + + let toFahrenheit (x: float) = + ((x * (9.0 / 5.0)) + 32.0) / 1.0 * 1.0 + + let toRankine (x: float) = + ((x + 273.15) * 1.8) / 1.0 * 1.0 + + [] + module Fahrenheit = + + let create (x: float) = x * 1.0 + + let toKelvin (x: float) = + ((x - 32.0) * (5.0 / 9.0) + 273.15) / 1.0 * 1.0 + + let toCelsius (x: float) = + ((x - 32.0) * (5.0 / 9.0)) / 1.0 * 1.0 + + let toRankine (x: float) = (x + 459.67) / 1.0 * 1.0 + + [] + module Rankine = + + let create (x: float) = x * 1.0 + let toKelvin (x: float) = (x * (5.0 / 9.0)) / 1.0 * 1.0 + + let toCelsius (x: float) = + ((x - 491.67) * (5.0 / 9.0)) / 1.0 * 1.0 + + let toFahrenheit (x: float) = (x - 459.67) / 1.0 * 1.0 diff --git a/Fs.Units/Simple/Time.fs b/src/Fs.Units/Simple/Time.fs similarity index 88% rename from Fs.Units/Simple/Time.fs rename to src/Fs.Units/Simple/Time.fs index 5e66138..f2c45fc 100644 --- a/Fs.Units/Simple/Time.fs +++ b/src/Fs.Units/Simple/Time.fs @@ -1,56 +1,71 @@ -namespace Fs.Units.Time - -module Units = - - /// Nanosecond - [] type ns - - /// Microsecond - [] type us - - /// Millisecond - [] type ms - - /// Second - [] type s - - /// Minute - [] type min - - /// Hour - [] type hr - - /// Day - [] type day - - /// Week - [] type week - - /// Fortnight - [] type fortnight - - /// Month - [] type month - - /// Year - [] type year - - /// Decade - [] type decade - - /// Century - [] type century - - /// Millennium - [] type millennium - - /// Aeon - [] type eon - -open Units - -module Nanosecond = - +namespace Fs.Units + +[] +module Time = + + /// Nanosecond + [] + type ns + + /// Microsecond + [] + type us + + /// Millisecond + [] + type ms + + /// Second + [] + type s + + /// Minute + [] + type min + + /// Hour + [] + type hr + + /// Day + [] + type day + + /// Week + [] + type week + + /// Fortnight + [] + type fortnight + + /// Month + [] + type month + + /// Year + [] + type year + + /// Decade + [] + type decade + + /// Century + [] + type century + + /// Millennium + [] + type millennium + + /// Aeon + [] + type eon + + [] + module Nanosecond = + let create (x: float) = x * 1.0 let toSeconds (x: float) = x * 1.0 / 1e-9 let toMicroSeconds (x: float) = x * 1e-3 / 1.0 @@ -66,9 +81,10 @@ module Nanosecond = let toCenturies (x: float) = x * 1.0 / 3.154e+18 let toMillennia (x: float) = x * 1.0 / 3.154e+19 let toEons (x: float) = x * 1.0 / 3.1536e+25 - -module Microsecond = - + + [] + module Microsecond = + let create (x: float) = x * 1.0 let toSeconds (x: float) = x * 1.0 / 1e-6 let toNanoSeconds (x: float) = x * 1e+3 / 1.0 @@ -84,9 +100,10 @@ module Microsecond = let toCenturies (x: float) = x * 1.0 / 3.154e+15 let toMillennia (x: float) = x * 1.0 / 3.154e+16 let toEons (x: float) = x * 1.0 / 3.1536e+22 - -module Millisecond = - + + [] + module Millisecond = + let create (x: float) = x * 1.0 let toSeconds (x: float) = x * 1.0 / 1e-3 let toNanoSeconds (x: float) = x * 1e+6 / 1.0 @@ -102,9 +119,10 @@ module Millisecond = let toCenturies (x: float) = x * 1.0 / 3.154e+12 let toMillennia (x: float) = x * 1.0 / 3.154e+13 let toEons (x: float) = x * 1.0 / 3.1536e+19 - -module Second = - + + [] + module Second = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 1e-9 / 1.0 let toMicroSeconds (x: float) = x * 1e-6 / 1.0 @@ -120,9 +138,10 @@ module Second = let toCenturies (x: float) = x * 1.0 / 3.154e+9 let toMillennia (x: float) = x * 1.0 / 3.154e+10 let toEons (x: float) = x * 1.0 / 3.1536e+16 - -module Minute = - + + [] + module Minute = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 6e+10 / 1.0 let toMicroSeconds (x: float) = x * 6e+7 / 1.0 @@ -138,9 +157,10 @@ module Minute = let toCenturies (x: float) = x * 1.0 / 5.256e+7 let toMillennia (x: float) = x * 1.0 / 5.256e+9 let toEons (x: float) = x * 1.0 / 5.256e+14 - -module Hour = - + + [] + module Hour = + let create (x: float) = x * 1.0
let toNanoSeconds (x: float
) = x * 3.6e+12 / 1.0
let toMicroSeconds (x: float
) = x * 3.6e+9 / 1.0
@@ -156,9 +176,10 @@ module Hour = let toCenturies (x: float
) = x * 1.0 / 876_582.0
let toMillennia (x: float
) = x * 1.0 / 8.76e+7
let toEons (x: float
) = x * 1.0 / 8.76e+12
- -module Day = - + + [] + module Day = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 8.64e+13 / 1.0 let toMicroSeconds (x: float) = x * 8.64e+10 / 1.0 @@ -174,9 +195,10 @@ module Day = let toCenturies (x: float) = x * 1.0 / 36525.0 let toMillennia (x: float) = x * 1.0 / 3.6525e+6 let toEons (x: float) = x * 1.0 / 3.65e+11 - -module Week = - + + [] + module Week = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 6.048e+14 / 1.0 let toMicroSeconds (x: float) = x * 6.048e+11 / 1.0 @@ -192,9 +214,10 @@ module Week = let toCenturies (x: float) = x * 1.0 / 5214.3 let toMillennia (x: float) = x * 1.0 / 5.2143e+5 let toEons (x: float) = x * 1.0 / 52142857142.857 - -module Fortnight = - + + [] + module Fortnight = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 1.21e+15 / 1.0 let toMicroSeconds (x: float) = x * 1.21e+12 / 1.0 @@ -208,11 +231,16 @@ module Fortnight = let toYears (x: float) = x * 1.0 / 26.071 let toDecades (x: float) = x * 1.0 / 260.71 let toCenturies (x: float) = x * 1.0 / 2607.1 - let toMillennia (x: float) = x * 1.0 / 26066.115702479 - let toEons (x: float) = x * 1.0 / 26062809917.355 - -module Month = - + + let toMillennia (x: float) = + x * 1.0 / 26066.115702479 + + let toEons (x: float) = + x * 1.0 / 26062809917.355 + + [] + module Month = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 2.628e+15 / 1.0 let toMicroSeconds (x: float) = x * 2.628e+12 / 1.0 @@ -228,9 +256,10 @@ module Month = let toCenturies (x: float) = x * 1.0 / 1200.0 let toMillennia (x: float) = x * 1.0 / 1.2e+7 let toEons (x: float) = x * 1.0 / 1.2e+13 - -module Year = - + + [] + module Year = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 3.154e+16 / 1.0 let toMicroSeconds (x: float) = x * 3.154e+13 / 1.0 @@ -246,9 +275,10 @@ module Year = let toCenturies (x: float) = x * 1.0 / 100.0 let toMillennia (x: float) = x * 1.0 / 1000.0 let toEons (x: float) = x * 1.0 / 1e+12 - -module Decade = - + + [] + module Decade = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 3.154e+17 / 1.0 let toMicroSeconds (x: float) = x * 3.154e+14 / 1.0 @@ -264,9 +294,10 @@ module Decade = let toCenturies (x: float) = x * 1.0 / 10.0 let toMillennia (x: float) = x * 1.0 / 100.0 let toEons (x: float) = x * 1.0 / 1e+11 - -module Century = - + + [] + module Century = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 3.154e+18 / 1.0 let toMicroSeconds (x: float) = x * 3.154e+15 / 1.0 @@ -282,9 +313,10 @@ module Century = let toDecades (x: float) = x * 10.0 / 1.0 let toMillennia (x: float) = x * 1.0 / 10.0 let toEons (x: float) = x * 1.0 / 1e+10 - -module Millennium = - + + [] + module Millennium = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 3.154e+19 / 1.0 let toMicroSeconds (x: float) = x * 3.154e+16 / 1.0 @@ -294,25 +326,32 @@ module Millennium = let toHours (x: float) = x * 8.76e+7
/ 1.0 let toDays (x: float) = x * 3.6525e+6 / 1.0 let toWeeks (x: float) = x * 5.2143e+5 / 1.0 - let toFortnights (x: float) = x * 26066.115702479 / 1.0 + + let toFortnights (x: float) = + x * 26066.115702479 / 1.0 + let toMonths (x: float) = x * 1.2e+7 / 1.0 let toYears (x: float) = x * 1000.0 / 1.0 let toDecades (x: float) = x * 100.0 / 1.0 let toCenturies (x: float) = x * 10.0 / 1.0 let toEons (x: float) = x * 1.0 / 1e+9 - -module Eon = - + + [] + module Eon = + let create (x: float) = x * 1.0 let toNanoSeconds (x: float) = x * 3.1536e+25 / 1.0 let toMicroSeconds (x: float) = x * 3.1536e+22 / 1.0 let toMilliSeconds (x: float) = x * 3.1536e+19 / 1.0 let toSeconds (x: float) = x * 3.1536e+16 / 1.0 let toMinutes (x: float) = x * 5.256e+14 / 1.0 - let toHours (x: float) = x * 8.76e+12
/ 1.0 + let toHours (x: float) = x * 8.76e+12
/ 1.0 let toDays (x: float) = x * 3.65e+11 / 1.0 let toWeeks (x: float) = x * 52142857142.857 / 1.0 - let toFortnights (x: float) = x * 26062809917.355 / 1.0 + + let toFortnights (x: float) = + x * 26062809917.355 / 1.0 + let toMonths (x: float) = x * 1.2e+13 / 1.0 let toYears (x: float) = x * 1e+12 / 1.0 let toDecades (x: float) = x * 1e+11 / 1.0 diff --git a/Fs.Units/paket.references b/src/Fs.Units/paket.references similarity index 100% rename from Fs.Units/paket.references rename to src/Fs.Units/paket.references diff --git a/tests/Fs.Units.Tests.Unit/AssemblyInfo.fs b/tests/Fs.Units.Tests.Unit/AssemblyInfo.fs new file mode 100644 index 0000000..f7b084c --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/AssemblyInfo.fs @@ -0,0 +1,19 @@ +// Auto-Generated by FAKE; do not edit +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "Fs.Units.Tests.Unit" + let [] AssemblyProduct = "Fs.Units" + let [] AssemblyDescription = "A simple library for working with units of measure in .NET" + let [] AssemblyVersion = "2.0.0" + let [] AssemblyFileVersion = "2.0.0" + let [] AssemblyConfiguration = "Release" diff --git a/tests/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs b/tests/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs new file mode 100644 index 0000000..431a2d8 --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/CompoundUnitsOfMeasureTests.fs @@ -0,0 +1,1209 @@ +module CompoundUnitOfMeasureTests + +open Expecto +open Fs.Units +open Helpers + +let areaTests config = + + let squareInchConversionTests = + [ + "To square feet and back", (fun x -> x |> SquareInch.toSquareFeet |> SquareFoot.toSquareInches) + "To square centimeters and back", + (fun x -> x |> SquareInch.toSquareCentimeters |> SquareCentimeter.toSquareInches) + "To square meters and back", (fun x -> x |> SquareInch.toSquareMeters |> SquareMeter.toSquareInches) + ] + |> List.map (fun (x, y) -> x, (fun z -> SquareInch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let squareFootConversionTests = + [ + "To square inches and back", (fun x -> x |> SquareFoot.toSquareInches |> SquareInch.toSquareFeet) + "To square centimeters and back", (fun x -> x |> SquareFoot.toSquareCentimeters |> SquareCentimeter.toSquareFeet) + "To square meters and back", (fun x -> x |> SquareFoot.toSquareMeters |> SquareMeter.toSquareFeet) + ] + |> List.map (fun (x, y) -> x, (fun z -> SquareFoot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let squareCentimeterConversionTests = + [ + "To square inches and back", (fun x -> x |> SquareCentimeter.toSquareInches |> SquareInch.toSquareCentimeters) + "To square feet and back", (fun x -> x |> SquareCentimeter.toSquareFeet |> SquareFoot.toSquareCentimeters) + "To square meters and back", (fun x -> x |> SquareCentimeter.toSquareMeters |> SquareMeter.toSquareCentimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> SquareCentimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let squareMeterConversionTests = + [ + "To square inches and back", (fun x -> x |> SquareMeter.toSquareInches |> SquareInch.toSquareMeters) + "To square feet and back", (fun x -> x |> SquareMeter.toSquareFeet |> SquareFoot.toSquareMeters) + "To square centimeters and back", + (fun x -> x |> SquareMeter.toSquareCentimeters |> SquareCentimeter.toSquareMeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> SquareMeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Area tests" + [ + testList "Square inch conversions" squareInchConversionTests + testList "Square foot conversions" squareFootConversionTests + testList "Square centimeter conversions" squareCentimeterConversionTests + testList "Square meter conversions" squareMeterConversionTests + ] + +let volumeTests config = + + let cubicInchConversionTests = + [ + "To cubic feet and back", (fun x -> x |> CubicInch.toCubicFeet |> CubicFoot.toCubicInches) + "To cubic centimeters and back", (fun x -> x |> CubicInch.toCubicCentimeters |> CubicCentimeter.toCubicInches) + "To cubic meters and back", (fun x -> x |> CubicInch.toCubicMeters |> CubicMeter.toCubicInches) + "To liters and back", (fun x -> x |> CubicInch.toLiters |> Liter.toCubicInches) + "To gallons and back", (fun x -> x |> CubicInch.toGallons |> Gallon.toCubicInches) + ] + |> List.map (fun (x, y) -> x, (fun z -> CubicInch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let cubicFootConversionTests = + [ + "To cubic inches and back", (fun x -> x |> CubicFoot.toCubicInches |> CubicInch.toCubicFeet) + "To cubic centimeters and back", (fun x -> x |> CubicFoot.toCubicCentimeters |> CubicCentimeter.toCubicFeet) + "To cubic meters and back", (fun x -> x |> CubicFoot.toCubicMeters |> CubicMeter.toCubicFeet) + "To liters and back", (fun x -> x |> CubicFoot.toLiters |> Liter.toCubicFeet) + "To gallons and back", (fun x -> x |> CubicFoot.toGallons |> Gallon.toCubicFeet) + ] + |> List.map (fun (x, y) -> x, (fun z -> CubicFoot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let cubicCentimeterConversionTests = + [ + "To cubic inches and back", (fun x -> x |> CubicCentimeter.toCubicInches |> CubicInch.toCubicCentimeters) + "To cubic feet and back", (fun x -> x |> CubicCentimeter.toCubicFeet |> CubicFoot.toCubicCentimeters) + "To cubic meters and back", (fun x -> x |> CubicCentimeter.toCubicMeters |> CubicMeter.toCubicCentimeters) + "To liters and back", (fun x -> x |> CubicCentimeter.toLiters |> Liter.toCubicCentimeters) + "To gallons and back", (fun x -> x |> CubicCentimeter.toGallons |> Gallon.toCubicCentimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> CubicCentimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let cubicMeterConversionTests = + [ + "To cubic inches and back", (fun x -> x |> CubicMeter.toCubicInches |> CubicInch.toCubicMeters) + "To cubic feet and back", (fun x -> x |> CubicMeter.toCubicFeet |> CubicFoot.toCubicMeters) + "To cubic centimeters and back", (fun x -> x |> CubicMeter.toCubicCentimeters |> CubicCentimeter.toCubicMeters) + "To liters and back", (fun x -> x |> CubicMeter.toLiters |> Liter.toCubicMeters) + "To gallons and back", (fun x -> x |> CubicMeter.toGallons |> Gallon.toCubicMeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> CubicMeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let literConversionTests = + [ + "To cubic inches and back", (fun x -> x |> Liter.toCubicInches |> CubicInch.toLiters) + "To cubic feet and back", (fun x -> x |> Liter.toCubicFeet |> CubicFoot.toLiters) + "To cubic centimeters and back", (fun x -> x |> Liter.toCubicCentimeters |> CubicCentimeter.toLiters) + "To cubic meters and back", (fun x -> x |> Liter.toCubicMeters |> CubicMeter.toLiters) + "To gallons and back", (fun x -> x |> Liter.toGallons |> Gallon.toLiters) + ] + |> List.map (fun (x, y) -> x, (fun z -> Liter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gallonConversionTests = + [ + "To cubic inches and back", (fun x -> x |> Gallon.toCubicInches |> CubicInch.toGallons) + "To cubic feet and back", (fun x -> x |> Gallon.toCubicFeet |> CubicFoot.toGallons) + "To cubic centimeters and back", (fun x -> x |> Gallon.toCubicCentimeters |> CubicCentimeter.toGallons) + "To cubic meters and back", (fun x -> x |> Gallon.toCubicMeters |> CubicMeter.toGallons) + "To liters and back", (fun x -> x |> Gallon.toLiters |> Liter.toGallons) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gallon.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Volume tests" + [ + testList "Cubic inch conversions" cubicInchConversionTests + testList "Cubic foot conversions" cubicFootConversionTests + testList "Cubic centimeter conversions" cubicCentimeterConversionTests + testList "Cubic meter conversions" cubicMeterConversionTests + testList "Liter conversions" literConversionTests + testList "Gallon conversions" gallonConversionTests + ] + +let inertiaTests config = + + let quarticInchConversionTests = + [ + "To quartic centimeters and back", + (fun x -> x |> QuarticInch.toQuarticCentimeters |> QuarticCentimeter.toQuarticInches) + ] + |> List.map (fun (x, y) -> x, (fun z -> QuarticInch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let quarticCentimeterConversionTests = + [ + "To quartic inches and back", + (fun x -> x |> QuarticCentimeter.toQuarticInches |> QuarticInch.toQuarticCentimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> QuarticCentimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Inertia tests" + [ + testList "Quartic inch conversions" quarticInchConversionTests + testList "Quartic centimeter conversions" quarticCentimeterConversionTests + ] + +let speedTests config = + + let feetPerSecondTests = + [ + "From feet per second to meters per second and back", + (fun x -> x |> FootPerSecond.toMetersPerSecond |> MeterPerSecond.toFeetPerSecond) + "From feet per second to kilometers per hour and back", + (fun x -> x |> FootPerSecond.toKilometersPerHour |> KilometerPerHour.toFeetPerSecond) + "From feet per second to miles per hour and back", + (fun x -> x |> FootPerSecond.toMilesPerHour |> MilePerHour.toFeetPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> FootPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let metersPerSecondTests = + [ + "From meter per second to feet per second and back", + (fun x -> x |> MeterPerSecond.toFeetPerSecond |> FootPerSecond.toMetersPerSecond) + "From meter per second to kilometers per hour and back", + (fun x -> x |> MeterPerSecond.toKilometersPerHour |> KilometerPerHour.toMetersPerSecond) + "From meter per second to miles per hour and back", + (fun x -> x |> MeterPerSecond.toMilesPerHour |> MilePerHour.toMetersPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> MeterPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilometersPerHourTests = + [ + "From kilometer per hour to feet per second and back", + (fun x -> x |> KilometerPerHour.toFeetPerSecond |> FootPerSecond.toKilometersPerHour) + "From kilometer per hour to meters per second and back", + (fun x -> x |> KilometerPerHour.toMetersPerSecond |> MeterPerSecond.toKilometersPerHour) + "From kilometer per hour to miles per hour and back", + (fun x -> x |> KilometerPerHour.toMilesPerHour |> MilePerHour.toKilometersPerHour) + ] + |> List.map (fun (x, y) -> x, (fun z -> KilometerPerHour.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let milesPerHourTests = + [ + "From mile per hour to feet per second and back", + (fun x -> x |> MilePerHour.toFeetPerSecond |> FootPerSecond.toMilesPerHour) + "From mile per hour to meters per second and back", + (fun x -> x |> MilePerHour.toMetersPerSecond |> MeterPerSecond.toMilesPerHour) + "From mile per hour to kilometers per hour and back", + (fun x -> x |> MilePerHour.toKilometersPerHour |> KilometerPerHour.toMilesPerHour) + ] + |> List.map (fun (x, y) -> x, (fun z -> MilePerHour.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Speed tests" + [ + testList "Feet per second tests" feetPerSecondTests + testList "Meters per second tests" metersPerSecondTests + testList "Kilometers per hour tests" kilometersPerHourTests + testList "Miles per hour tests" milesPerHourTests + ] + +let forceTests config = + + let newtonConversionTests = + [ + "To pound force and back", (fun x -> x |> Newton.toPoundForce |> PoundForce.toNewtons) + "To dynes and back", (fun x -> x |> Newton.toDynes |> Dyne.toNewtons) + "To kips and back", (fun x -> x |> Newton.toKips |> Kip.toNewtons) + ] + |> List.map (fun (x, y) -> x, (fun z -> Newton.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let poundForceConversionTests = + [ + "To newtons and back", (fun x -> x |> PoundForce.toNewtons |> Newton.toPoundForce) + "To dynes and back", (fun x -> x |> PoundForce.toDynes |> Dyne.toPoundForce) + "To kips and back", (fun x -> x |> PoundForce.toKips |> Kip.toPoundForce) + ] + |> List.map (fun (x, y) -> x, (fun z -> PoundForce.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let dyneConversionTests = + [ + "To newtons and back", (fun x -> x |> Dyne.toNewtons |> Newton.toDynes) + "To pound force and back", (fun x -> x |> Dyne.toPoundForce |> PoundForce.toDynes) + "To kips and back", (fun x -> x |> Dyne.toKips |> Kip.toDynes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Dyne.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kipConversionTests = + [ + "To newtons and back", (fun x -> x |> Kip.toNewtons |> Newton.toKips) + "To pound force and back", (fun x -> x |> Kip.toPoundForce |> PoundForce.toKips) + "To dynes and back", (fun x -> x |> Kip.toDynes |> Dyne.toKips) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kip.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Force tests" + [ + testList "Newton conversions" newtonConversionTests + testList "Pound force conversions" poundForceConversionTests + testList "Dyne conversions" dyneConversionTests + testList "Kip conversions" kipConversionTests + ] + +let dataTransferRateTests config = + + let baudPerSecondConversionTests = + [ + "To bits per second", (fun x -> x |> Baud.toBitsPerSecond |> BitPerSecond.toBauds) + "To kilobits per second", (fun x -> x |> Baud.toKilobitsPerSecond |> KilobitPerSecond.toBauds) + "To megabits per second", (fun x -> x |> Baud.toMegabitsPerSecond |> MegabitPerSecond.toBauds) + "To gigabits per second", (fun x -> x |> Baud.toGigabitsPerSecond |> GigabitPerSecond.toBauds) + "To terabits per second", (fun x -> x |> Baud.toTerabitsPerSecond |> TerabitPerSecond.toBauds) + "To petabits per second", (fun x -> x |> Baud.toPetabitsPerSecond |> PetabitPerSecond.toBauds) + "To bytes per second", (fun x -> x |> Baud.toBytesPerSecond |> BytePerSecond.toBauds) + "To kilobytes per second", (fun x -> x |> Baud.toKilobytesPerSecond |> KilobytePerSecond.toBauds) + "To megabytes per second", (fun x -> x |> Baud.toMegabytesPerSecond |> MegabytePerSecond.toBauds) + "To gigabytes per second", (fun x -> x |> Baud.toGigabytesPerSecond |> GigabytePerSecond.toBauds) + "To terabytes per second", (fun x -> x |> Baud.toTerabytesPerSecond |> TerabytePerSecond.toBauds) + "To petabytes per second", (fun x -> x |> Baud.toPetabytesPerSecond |> PetabytePerSecond.toBauds) + ] + |> List.map (fun (x, y) -> x, (fun z -> Baud.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let bitPerSecondConversionTests = + [ + "From bit per second to baud", (fun x -> x |> BitPerSecond.toBauds |> Baud.toBitsPerSecond) + "From bit per second to kilobits per second", + (fun x -> x |> BitPerSecond.toKilobitsPerSecond |> KilobitPerSecond.toBitsPerSecond) + "From bit per second to megabits per second", + (fun x -> x |> BitPerSecond.toMegabitsPerSecond |> MegabitPerSecond.toBitsPerSecond) + "From bit per second to gigabits per second", + (fun x -> x |> BitPerSecond.toGigabitsPerSecond |> GigabitPerSecond.toBitsPerSecond) + "From bit per second to terabits per second", + (fun x -> x |> BitPerSecond.toTerabitsPerSecond |> TerabitPerSecond.toBitsPerSecond) + "From bit per second to petabits per second", + (fun x -> x |> BitPerSecond.toPetabitsPerSecond |> PetabitPerSecond.toBitsPerSecond) + "From bit per second to bytes per second", + (fun x -> x |> BitPerSecond.toBytesPerSecond |> BytePerSecond.toBitsPerSecond) + "From bit per second to kilobytes per second", + (fun x -> x |> BitPerSecond.toKilobytesPerSecond |> KilobytePerSecond.toBitsPerSecond) + "From bit per second to megabytes per second", + (fun x -> x |> BitPerSecond.toMegabytesPerSecond |> MegabytePerSecond.toBitsPerSecond) + "From bit per second to gigabytes per second", + (fun x -> x |> BitPerSecond.toGigabytesPerSecond |> GigabytePerSecond.toBitsPerSecond) + "From bit per second to terabytes per second", + (fun x -> x |> BitPerSecond.toTerabytesPerSecond |> TerabytePerSecond.toBitsPerSecond) + "From bit per second to petabytes per second", + (fun x -> x |> BitPerSecond.toPetabytesPerSecond |> PetabytePerSecond.toBitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> BitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilobitPerSecondConversionTests = + [ + "From kilobit per second to baud", (fun x -> x |> KilobitPerSecond.toBauds |> Baud.toKilobitsPerSecond) + "From kilobit per second to bits per second", + (fun x -> x |> KilobitPerSecond.toBitsPerSecond |> BitPerSecond.toKilobitsPerSecond) + "From kilobit per second to megabits per second", + (fun x -> + x + |> KilobitPerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toKilobitsPerSecond) + "From kilobit per second to gigabits per second", + (fun x -> + x + |> KilobitPerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toKilobitsPerSecond) + "From kilobit per second to terabits per second", + (fun x -> + x + |> KilobitPerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toKilobitsPerSecond) + "From kilobit per second to petabits per second", + (fun x -> + x + |> KilobitPerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toKilobitsPerSecond) + "From kilobit per second to bytes per second", + (fun x -> x |> KilobitPerSecond.toBytesPerSecond |> BytePerSecond.toKilobitsPerSecond) + "From kilobit per second to kilobytes per second", + (fun x -> + x + |> KilobitPerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toKilobitsPerSecond) + "From kilobit per second to megabytes per second", + (fun x -> + x + |> KilobitPerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toKilobitsPerSecond) + "From kilobit per second to gigabytes per second", + (fun x -> + x + |> KilobitPerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toKilobitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> KilobitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megabitPerSecondConversionTests = + [ + "From megabit per second to baud", (fun x -> x |> MegabitPerSecond.toBauds |> Baud.toMegabitsPerSecond) + "From megabit per second to bits per second", + (fun x -> x |> MegabitPerSecond.toBitsPerSecond |> BitPerSecond.toMegabitsPerSecond) + "From megabit per second to kilobits per second", + (fun x -> + x + |> MegabitPerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toMegabitsPerSecond) + "From megabit per second to gigabits per second", + (fun x -> + x + |> MegabitPerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toMegabitsPerSecond) + "From megabit per second to terabits per second", + (fun x -> + x + |> MegabitPerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toMegabitsPerSecond) + "From megabit per second to petabits per second", + (fun x -> + x + |> MegabitPerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toMegabitsPerSecond) + "From megabit per second to bytes per second", + (fun x -> x |> MegabitPerSecond.toBytesPerSecond |> BytePerSecond.toMegabitsPerSecond) + "From megabit per second to kilobytes per second", + (fun x -> + x + |> MegabitPerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toMegabitsPerSecond) + "From megabit per second to megabytes per second", + (fun x -> + x + |> MegabitPerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toMegabitsPerSecond) + "From megabit per second to gigabytes per second", + (fun x -> + x + |> MegabitPerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toMegabitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> MegabitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gigabitPerSecondConversionTests = + [ + "From gigabit per second to baud", (fun x -> x |> GigabitPerSecond.toBauds |> Baud.toGigabitsPerSecond) + "From gigabit per second to bits per second", + (fun x -> x |> GigabitPerSecond.toBitsPerSecond |> BitPerSecond.toGigabitsPerSecond) + "From gigabit per second to kilobits per second", + (fun x -> + x + |> GigabitPerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toGigabitsPerSecond) + "From gigabit per second to megabits per second", + (fun x -> + x + |> GigabitPerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toGigabitsPerSecond) + "From gigabit per second to terabits per second", + (fun x -> + x + |> GigabitPerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toGigabitsPerSecond) + "From gigabit per second to petabits per second", + (fun x -> + x + |> GigabitPerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toGigabitsPerSecond) + "From gigabit per second to bytes per second", + (fun x -> x |> GigabitPerSecond.toBytesPerSecond |> BytePerSecond.toGigabitsPerSecond) + "From gigabit per second to kilobytes per second", + (fun x -> + x + |> GigabitPerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toGigabitsPerSecond) + "From gigabit per second to megabytes per second", + (fun x -> + x + |> GigabitPerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toGigabitsPerSecond) + "From gigabit per second to gigabytes per second", + (fun x -> + x + |> GigabitPerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toGigabitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> GigabitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let terabitPerSecondConversionTests = + [ + "From terabit per second to baud", (fun x -> x |> TerabitPerSecond.toBauds |> Baud.toTerabitsPerSecond) + "From terabit per second to bits per second", + (fun x -> x |> TerabitPerSecond.toBitsPerSecond |> BitPerSecond.toTerabitsPerSecond) + "From terabit per second to kilobits per second", + (fun x -> + x + |> TerabitPerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toTerabitsPerSecond) + "From terabit per second to megabits per second", + (fun x -> + x + |> TerabitPerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toTerabitsPerSecond) + "From terabit per second to gigabits per second", + (fun x -> + x + |> TerabitPerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toTerabitsPerSecond) + "From terabit per second to petabits per second", + (fun x -> + x + |> TerabitPerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toTerabitsPerSecond) + "From terabit per second to bytes per second", + (fun x -> x |> TerabitPerSecond.toBytesPerSecond |> BytePerSecond.toTerabitsPerSecond) + "From terabit per second to kilobytes per second", + (fun x -> + x + |> TerabitPerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toTerabitsPerSecond) + "From terabit per second to megabytes per second", + (fun x -> + x + |> TerabitPerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toTerabitsPerSecond) + "From terabit per second to gigabytes per second", + (fun x -> + x + |> TerabitPerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toTerabitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> TerabitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let petabitPerSecondConversionTests = + [ + "From petabit per second to baud", (fun x -> x |> PetabitPerSecond.toBauds |> Baud.toPetabitsPerSecond) + "From petabit per second to bits per second", + (fun x -> x |> PetabitPerSecond.toBitsPerSecond |> BitPerSecond.toPetabitsPerSecond) + "From petabit per second to kilobits per second", + (fun x -> + x + |> PetabitPerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toPetabitsPerSecond) + "From petabit per second to megabits per second", + (fun x -> + x + |> PetabitPerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toPetabitsPerSecond) + "From petabit per second to gigabits per second", + (fun x -> + x + |> PetabitPerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toPetabitsPerSecond) + "From petabit per second to terabits per second", + (fun x -> + x + |> PetabitPerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toPetabitsPerSecond) + "From petabit per second to bytes per second", + (fun x -> x |> PetabitPerSecond.toBytesPerSecond |> BytePerSecond.toPetabitsPerSecond) + "From petabit per second to kilobytes per second", + (fun x -> + x + |> PetabitPerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toPetabitsPerSecond) + "From petabit per second to megabytes per second", + (fun x -> + x + |> PetabitPerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toPetabitsPerSecond) + "From petabit per second to gigabytes per second", + (fun x -> + x + |> PetabitPerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toPetabitsPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> PetabitPerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let bytePerSecondConversionTests = + [ + "From byte per second to baud", (fun x -> x |> BytePerSecond.toBauds |> Baud.toBytesPerSecond) + "From byte per second to bits per second", + (fun x -> x |> BytePerSecond.toBitsPerSecond |> BitPerSecond.toBytesPerSecond) + "From byte per second to kilobits per second", + (fun x -> x |> BytePerSecond.toKilobitsPerSecond |> KilobitPerSecond.toBytesPerSecond) + "From byte per second to megabits per second", + (fun x -> x |> BytePerSecond.toMegabitsPerSecond |> MegabitPerSecond.toBytesPerSecond) + "From byte per second to gigabits per second", + (fun x -> x |> BytePerSecond.toGigabitsPerSecond |> GigabitPerSecond.toBytesPerSecond) + "From byte per second to terabits per second", + (fun x -> x |> BytePerSecond.toTerabitsPerSecond |> TerabitPerSecond.toBytesPerSecond) + "From byte per second to petabits per second", + (fun x -> x |> BytePerSecond.toPetabitsPerSecond |> PetabitPerSecond.toBytesPerSecond) + "From byte per second to kilobytes per second", + (fun x -> x |> BytePerSecond.toKilobytesPerSecond |> KilobytePerSecond.toBytesPerSecond) + "From byte per second to megabytes per second", + (fun x -> x |> BytePerSecond.toMegabytesPerSecond |> MegabytePerSecond.toBytesPerSecond) + "From byte per second to gigabytes per second", + (fun x -> x |> BytePerSecond.toGigabytesPerSecond |> GigabytePerSecond.toBytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> BytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilobytePerSecondConversionTests = + [ + "From kilobyte per second to baud", (fun x -> x |> KilobytePerSecond.toBauds |> Baud.toKilobytesPerSecond) + "From kilobyte per second to bits per second", + (fun x -> x |> KilobytePerSecond.toBitsPerSecond |> BitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to kilobits per second", + (fun x -> + x + |> KilobytePerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to megabits per second", + (fun x -> + x + |> KilobytePerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to gigabits per second", + (fun x -> + x + |> KilobytePerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to terabits per second", + (fun x -> + x + |> KilobytePerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to petabits per second", + (fun x -> + x + |> KilobytePerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toKilobytesPerSecond) + "From kilobyte per second to bytes per second", + (fun x -> x |> KilobytePerSecond.toBytesPerSecond |> BytePerSecond.toKilobytesPerSecond) + "From kilobyte per second to megabytes per second", + (fun x -> + x + |> KilobytePerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toKilobytesPerSecond) + "From kilobyte per second to gigabytes per second", + (fun x -> + x + |> KilobytePerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toKilobytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> KilobytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megabytePerSecondConversionTests = + [ + "From megabyte per second to baud", (fun x -> x |> MegabytePerSecond.toBauds |> Baud.toMegabytesPerSecond) + "From megabyte per second to bits per second", + (fun x -> x |> MegabytePerSecond.toBitsPerSecond |> BitPerSecond.toMegabytesPerSecond) + "From megabyte per second to kilobits per second", + (fun x -> + x + |> MegabytePerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toMegabytesPerSecond) + "From megabyte per second to megabits per second", + (fun x -> + x + |> MegabytePerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toMegabytesPerSecond) + "From megabyte per second to gigabits per second", + (fun x -> + x + |> MegabytePerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toMegabytesPerSecond) + "From megabyte per second to terabits per second", + (fun x -> + x + |> MegabytePerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toMegabytesPerSecond) + "From megabyte per second to petabits per second", + (fun x -> + x + |> MegabytePerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toMegabytesPerSecond) + "From megabyte per second to bytes per second", + (fun x -> x |> MegabytePerSecond.toBytesPerSecond |> BytePerSecond.toMegabytesPerSecond) + "From megabyte per second to kilobytes per second", + (fun x -> + x + |> MegabytePerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toMegabytesPerSecond) + "From megabyte per second to gigabytes per second", + (fun x -> + x + |> MegabytePerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toMegabytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> MegabytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gigabytePerSecondConversionTests = + [ + "From gigabyte per second to baud", (fun x -> x |> GigabytePerSecond.toBauds |> Baud.toGigabytesPerSecond) + "From gigabyte per second to bits per second", + (fun x -> x |> GigabytePerSecond.toBitsPerSecond |> BitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to kilobits per second", + (fun x -> + x + |> GigabytePerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to megabits per second", + (fun x -> + x + |> GigabytePerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to gigabits per second", + (fun x -> + x + |> GigabytePerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to terabits per second", + (fun x -> + x + |> GigabytePerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to petabits per second", + (fun x -> + x + |> GigabytePerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toGigabytesPerSecond) + "From gigabyte per second to bytes per second", + (fun x -> x |> GigabytePerSecond.toBytesPerSecond |> BytePerSecond.toGigabytesPerSecond) + "From gigabyte per second to kilobytes per second", + (fun x -> + x + |> GigabytePerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toGigabytesPerSecond) + "From gigabyte per second to megabytes per second", + (fun x -> + x + |> GigabytePerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toGigabytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> GigabytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let terabytePerSecondConversionTests = + [ + "From terabyte per second to baud", (fun x -> x |> TerabytePerSecond.toBauds |> Baud.toTerabytesPerSecond) + "From terabyte per second to bits per second", + (fun x -> x |> TerabytePerSecond.toBitsPerSecond |> BitPerSecond.toTerabytesPerSecond) + "From terabyte per second to kilobits per second", + (fun x -> + x + |> TerabytePerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toTerabytesPerSecond) + "From terabyte per second to megabits per second", + (fun x -> + x + |> TerabytePerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toTerabytesPerSecond) + "From terabyte per second to gigabits per second", + (fun x -> + x + |> TerabytePerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toTerabytesPerSecond) + "From terabyte per second to terabits per second", + (fun x -> + x + |> TerabytePerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toTerabytesPerSecond) + "From terabyte per second to petabits per second", + (fun x -> + x + |> TerabytePerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toTerabytesPerSecond) + "From terabyte per second to bytes per second", + (fun x -> x |> TerabytePerSecond.toBytesPerSecond |> BytePerSecond.toTerabytesPerSecond) + "From terabyte per second to kilobytes per second", + (fun x -> + x + |> TerabytePerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toTerabytesPerSecond) + "From terabyte per second to megabytes per second", + (fun x -> + x + |> TerabytePerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toTerabytesPerSecond) + "From terabyte per second to gigabytes per second", + (fun x -> + x + |> TerabytePerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toTerabytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> TerabytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let petabytePerSecondConversionTests = + [ + "From petabyte per second to baud", (fun x -> x |> PetabytePerSecond.toBauds |> Baud.toPetabytesPerSecond) + "From petabyte per second to bits per second", + (fun x -> x |> PetabytePerSecond.toBitsPerSecond |> BitPerSecond.toPetabytesPerSecond) + "From petabyte per second to kilobits per second", + (fun x -> + x + |> PetabytePerSecond.toKilobitsPerSecond + |> KilobitPerSecond.toPetabytesPerSecond) + "From petabyte per second to megabits per second", + (fun x -> + x + |> PetabytePerSecond.toMegabitsPerSecond + |> MegabitPerSecond.toPetabytesPerSecond) + "From petabyte per second to gigabits per second", + (fun x -> + x + |> PetabytePerSecond.toGigabitsPerSecond + |> GigabitPerSecond.toPetabytesPerSecond) + "From petabyte per second to terabits per second", + (fun x -> + x + |> PetabytePerSecond.toTerabitsPerSecond + |> TerabitPerSecond.toPetabytesPerSecond) + "From petabyte per second to petabits per second", + (fun x -> + x + |> PetabytePerSecond.toPetabitsPerSecond + |> PetabitPerSecond.toPetabytesPerSecond) + "From petabyte per second to bytes per second", + (fun x -> x |> PetabytePerSecond.toBytesPerSecond |> BytePerSecond.toPetabytesPerSecond) + "From petabyte per second to kilobytes per second", + (fun x -> + x + |> PetabytePerSecond.toKilobytesPerSecond + |> KilobytePerSecond.toPetabytesPerSecond) + "From petabyte per second to megabytes per second", + (fun x -> + x + |> PetabytePerSecond.toMegabytesPerSecond + |> MegabytePerSecond.toPetabytesPerSecond) + "From petabyte per second to gigabytes per second", + (fun x -> + x + |> PetabytePerSecond.toGigabytesPerSecond + |> GigabytePerSecond.toPetabytesPerSecond) + ] + |> List.map (fun (x, y) -> x, (fun z -> PetabytePerSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Data transfer rate tests" + [ + testList "Baud per second conversions" baudPerSecondConversionTests + testList "Bit per second conversions" bitPerSecondConversionTests + testList "Kilobit per second conversions" kilobitPerSecondConversionTests + testList "Megabit per second conversions" megabitPerSecondConversionTests + testList "Gigabit per second conversions" gigabitPerSecondConversionTests + testList "Terabit per second conversions" terabitPerSecondConversionTests + testList "Petabit per second conversions" petabitPerSecondConversionTests + testList "Byte per second conversions" bytePerSecondConversionTests + testList "Kilobyte per second conversions" kilobytePerSecondConversionTests + testList "Megabyte per second conversions" megabytePerSecondConversionTests + testList "Gigabyte per second conversions" gigabytePerSecondConversionTests + testList "Terabyte per second conversions" terabytePerSecondConversionTests + testList "Petabyte per second conversions" petabytePerSecondConversionTests + ] + +let densityTests config = + + let kilogramPerCubicMeterConversionTests = + [ + "From kilogram per cubic meter to grams per cubic centimeter", + (fun x -> + x + |> KilogramPerCubicMeter.toGramsPerCubicCentimeter + |> GramPerCubicCentimeter.toKilogramsPerCubicMeter) + "From kilogram per cubic meter to pound mass per cubic foot", + (fun x -> + x + |> KilogramPerCubicMeter.toPoundMassPerCubicFoot + |> PoundMassPerCubicFoot.toKilogramsPerCubicMeter) + "From kilogram per cubic meter to pound mass per cubic inch", + (fun x -> + x + |> KilogramPerCubicMeter.toPoundMassPerCubicInch + |> PoundMassPerCubicInch.toKilogramsPerCubicMeter) + ] + |> List.map (fun (x, y) -> x, (fun z -> KilogramPerCubicMeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gramPerCubicCentimeterConversionTests = + [ + "From gram per cubic centimeter to kilogram per cubic meter", + (fun x -> + x + |> GramPerCubicCentimeter.toKilogramsPerCubicMeter + |> KilogramPerCubicMeter.toGramsPerCubicCentimeter) + "From gram per cubic centimeter to pound mass per cubic foot", + (fun x -> + x + |> GramPerCubicCentimeter.toPoundMassPerCubicFoot + |> PoundMassPerCubicFoot.toGramsPerCubicCentimeter) + "From gram per cubic centimeter to pound mass per cubic inch", + (fun x -> + x + |> GramPerCubicCentimeter.toPoundMassPerCubicInch + |> PoundMassPerCubicInch.toGramsPerCubicCentimeter) + ] + |> List.map (fun (x, y) -> x, (fun z -> GramPerCubicCentimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let poundMassPerCubicFootConversionTests = + [ + "From pound mass per cubic foot to kilogram per cubic meter", + (fun x -> + x + |> PoundMassPerCubicFoot.toKilogramsPerCubicMeter + |> KilogramPerCubicMeter.toPoundMassPerCubicFoot) + "From pound mass per cubic foot to grams per cubic centimeter", + (fun x -> + x + |> PoundMassPerCubicFoot.toGramsPerCubicCentimeter + |> GramPerCubicCentimeter.toPoundMassPerCubicFoot) + "From pound mass per cubic foot to pound mass per cubic inch", + (fun x -> + x + |> PoundMassPerCubicFoot.toPoundMassPerCubicInch + |> PoundMassPerCubicInch.toPoundMassPerCubicFoot) + ] + |> List.map (fun (x, y) -> x, (fun z -> PoundMassPerCubicFoot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let poundMassPerCubicInchConversionTests = + [ + "From pound mass per cubic inch to kilogram per cubic meter", + (fun x -> + x + |> PoundMassPerCubicInch.toKilogramsPerCubicMeter + |> KilogramPerCubicMeter.toPoundMassPerCubicInch) + "From pound mass per cubic inch to grams per cubic centimeter", + (fun x -> + x + |> PoundMassPerCubicInch.toGramsPerCubicCentimeter + |> GramPerCubicCentimeter.toPoundMassPerCubicInch) + "From pound mass per cubic inch to pound mass per cubic foot", + (fun x -> + x + |> PoundMassPerCubicInch.toPoundMassPerCubicFoot + |> PoundMassPerCubicFoot.toPoundMassPerCubicInch) + ] + |> List.map (fun (x, y) -> x, (fun z -> PoundMassPerCubicInch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Density tests" + [ + testList "Kilogram per cubic meter conversions" kilogramPerCubicMeterConversionTests + testList "Gram per cubic centimeter conversions" gramPerCubicCentimeterConversionTests + testList "Pound mass per cubic foot conversions" poundMassPerCubicFootConversionTests + testList "Pound mass per cubic inch conversions" poundMassPerCubicInchConversionTests + ] + +let pressureTests config = + + let pascalConversionTests = + [ + "To pounds per square inch", (fun x -> x |> Pascal.toPoundsPerSquareInch |> PoundPerSquareInch.toPascals) + ] + |> List.map (fun (x, y) -> x, (fun z -> Pascal.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let poundPerSquareInchConversionTests = + [ + "From pounds per square inch to pascal", + (fun x -> x |> PoundPerSquareInch.toPascals |> Pascal.toPoundsPerSquareInch) + ] + |> List.map (fun (x, y) -> x, (fun z -> PoundPerSquareInch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Pressure tests" + [ + testList "Pascal conversions" pascalConversionTests + testList "Pound per square inch conversions" poundPerSquareInchConversionTests + ] + +let powerTests config = + + let wattConversionTests = + [ + "To kilowatt", (fun x -> x |> Watt.toKilowatts |> Kilowatt.toWatts) + "To horsepower", (fun x -> x |> Watt.toHorsepower |> Horsepower.toWatts) + "To tons of refrigeration", (fun x -> x |> Watt.toTonsOfRefrigeration |> TonOfRefrigeration.toWatts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Watt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilowattConversionTests = + [ + "To watt", (fun x -> x |> Kilowatt.toWatts |> Watt.toKilowatts) + "To horsepower", (fun x -> x |> Kilowatt.toHorsepower |> Horsepower.toKilowatts) + "To tons of refrigeration", (fun x -> x |> Kilowatt.toTonsOfRefrigeration |> TonOfRefrigeration.toKilowatts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilowatt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let horsepowerConversionTests = + [ + "To watt", (fun x -> x |> Horsepower.toWatts |> Watt.toHorsepower) + "To kiloWatt", (fun x -> x |> Horsepower.toKilowatts |> Kilowatt.toHorsepower) + "To tons of refrigeration", (fun x -> x |> Horsepower.toTonsOfRefrigeration |> TonOfRefrigeration.toHorsepower) + ] + |> List.map (fun (x, y) -> x, (fun z -> Horsepower.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let tonOfRefrigerationConversionTests = + [ + "From tons of refrigeration to watt", (fun x -> x |> TonOfRefrigeration.toWatts |> Watt.toTonsOfRefrigeration) + "From tons of refrigeration to kilowatt", + (fun x -> x |> TonOfRefrigeration.toKilowatts |> Kilowatt.toTonsOfRefrigeration) + "From tons of refrigeration to horsepower", + (fun x -> x |> TonOfRefrigeration.toHorsepower |> Horsepower.toTonsOfRefrigeration) + ] + |> List.map (fun (x, y) -> x, (fun z -> TonOfRefrigeration.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Power tests" + [ + testList "Watt conversions" wattConversionTests + testList "Kilowatt conversions" kilowattConversionTests + testList "Horsepower conversions" horsepowerConversionTests + testList "Ton of refrigeration conversions" tonOfRefrigerationConversionTests + ] + +let energyTests config = + + let jouleConversionTests = + [ + "To kilojoule and back", (fun x -> x |> Joule.toKilojoules |> Kilojoule.toJoules) + "To british thermal units and back", (fun x -> x |> Joule.toBritishThermalUnits |> BritishThermalUnit.toJoules) + "To calories and back", (fun x -> x |> Joule.toCalories |> Calorie.toJoules) + "To quads and back", (fun x -> x |> Joule.toQuads |> Quad.toJoules) + "To Qs and back", (fun x -> x |> Joule.toQs |> Q.toJoules) + ] + |> List.map (fun (x, y) -> x, (fun z -> Joule.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilojouleConversionTests = + [ + "To joule and back", (fun x -> x |> Kilojoule.toJoules |> Joule.toKilojoules) + "To british thermal units and back", + (fun x -> x |> Kilojoule.toBritishThermalUnits |> BritishThermalUnit.toKilojoules) + "To calories and back", (fun x -> x |> Kilojoule.toCalories |> Calorie.toKilojoules) + "To quads and back", (fun x -> x |> Kilojoule.toQuads |> Quad.toKilojoules) + "To Qs and back", (fun x -> x |> Kilojoule.toQs |> Q.toKilojoules) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilojoule.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let britishThermalUnitConversionTests = + [ + "From british thermal unit to joule and back", + (fun x -> x |> BritishThermalUnit.toJoules |> Joule.toBritishThermalUnits) + "From british thermal unit to kilojoule and back", + (fun x -> x |> BritishThermalUnit.toKilojoules |> Kilojoule.toBritishThermalUnits) + "From british thermal unit to calories and back", + (fun x -> x |> BritishThermalUnit.toCalories |> Calorie.toBritishThermalUnits) + "From british thermal unit to quads and back", + (fun x -> x |> BritishThermalUnit.toQuads |> Quad.toBritishThermalUnits) + "From british thermal unit to Qs and back", (fun x -> x |> BritishThermalUnit.toQs |> Q.toBritishThermalUnits) + ] + |> List.map (fun (x, y) -> x, (fun z -> BritishThermalUnit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let calorieConversionTests = + [ + "To joule and back", (fun x -> x |> Calorie.toJoules |> Joule.toCalories) + "To kilojoule and back", (fun x -> x |> Calorie.toKilojoules |> Kilojoule.toCalories) + "To british thermal units and back", + (fun x -> x |> Calorie.toBritishThermalUnits |> BritishThermalUnit.toCalories) + "To quads and back", (fun x -> x |> Calorie.toQuads |> Quad.toCalories) + "To Qs and back", (fun x -> x |> Calorie.toQs |> Q.toCalories) + ] + |> List.map (fun (x, y) -> x, (fun z -> Calorie.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let quadConversionTests = + [ + "To joule and back", (fun x -> x |> Quad.toJoules |> Joule.toQuads) + "To kilojoule and back", (fun x -> x |> Quad.toKilojoules |> Kilojoule.toQuads) + "To british thermal units and back", (fun x -> x |> Quad.toBritishThermalUnits |> BritishThermalUnit.toQuads) + "To calories and back", (fun x -> x |> Quad.toCalories |> Calorie.toQuads) + "To Qs and back", (fun x -> x |> Quad.toQs |> Q.toQuads) + ] + |> List.map (fun (x, y) -> x, (fun z -> Quad.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let qConversionTests = + [ + "To joule and back", (fun x -> x |> Q.toJoules |> Joule.toQs) + "To kilojoule and back", (fun x -> x |> Q.toKilojoules |> Kilojoule.toQs) + "To british thermal units and back", (fun x -> x |> Q.toBritishThermalUnits |> BritishThermalUnit.toQs) + "To calories and back", (fun x -> x |> Q.toCalories |> Calorie.toQs) + "To quads and back", (fun x -> x |> Q.toQuads |> Quad.toQs) + ] + |> List.map (fun (x, y) -> x, (fun z -> Q.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Energy tests" + [ + testList "Joule conversion tests" jouleConversionTests + testList "Kilojoule conversions" kilojouleConversionTests + testList "British thermal unit conversions" britishThermalUnitConversionTests + testList "Calorie conversions" calorieConversionTests + testList "Quad conversions" quadConversionTests + testList "Q conversions" qConversionTests + ] + +let electricChargeTests config = + + let coloumbConversionTests = + [ + "To ampere hours and back", (fun x -> x |> Coulomb.toAmpereHours |> AmpereHour.toCoulombs) + "To ampere seconds and back", (fun x -> x |> Coulomb.toAmpereSeconds |> AmpereSecond.toCoulombs) + ] + |> List.map (fun (x, y) -> x, (fun z -> Coulomb.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let ampereHourConversionTests = + [ + "To coloumbs and back", (fun x -> x |> AmpereHour.toCoulombs |> Coulomb.toAmpereHours) + "To ampere seconds and back", (fun x -> x |> AmpereHour.toAmpereSeconds |> AmpereSecond.toAmpereHours) + ] + |> List.map (fun (x, y) -> x, (fun z -> AmpereHour.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let ampereSecondConversionTests = + [ + "To coloumbs and back", (fun x -> x |> AmpereSecond.toCoulombs |> Coulomb.toAmpereSeconds) + "To ampere hours and back", (fun x -> x |> AmpereSecond.toAmpereHours |> AmpereHour.toAmpereSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> AmpereSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Electric charge tests" + [ + testList "Coloumb conversion tests" coloumbConversionTests + testList "Ampere hour conversions" ampereHourConversionTests + testList "Ampere second conversions" ampereSecondConversionTests + ] + +let electromotiveForceTests config = + + let microvoltConversionTests = + [ + "To millivolts and back", (fun x -> x |> Microvolt.toMillivolts |> Millivolt.toMicrovolts) + "To volts and back", (fun x -> x |> Microvolt.toVolts |> Volt.toMicrovolts) + "To kilovolts and back", (fun x -> x |> Microvolt.toKilovolts |> Kilovolt.toMicrovolts) + "To megavolts and back", (fun x -> x |> Microvolt.toMegavolts |> Megavolt.toMicrovolts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Microvolt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let millivoltConversionTests = + [ + "To microvolts and back", (fun x -> x |> Millivolt.toMicrovolts |> Microvolt.toMillivolts) + "To volts and back", (fun x -> x |> Millivolt.toVolts |> Volt.toMillivolts) + "To kilovolts and back", (fun x -> x |> Millivolt.toKilovolts |> Kilovolt.toMillivolts) + "To megavolts and back", (fun x -> x |> Millivolt.toMegavolts |> Megavolt.toMillivolts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Millivolt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let voltConversionTests = + [ + "To microvolts and back", (fun x -> x |> Volt.toMicrovolts |> Microvolt.toVolts) + "To millivolts and back", (fun x -> x |> Volt.toMillivolts |> Millivolt.toVolts) + "To kilovolts and back", (fun x -> x |> Volt.toKilovolts |> Kilovolt.toVolts) + "To megavolts and back", (fun x -> x |> Volt.toMegavolts |> Megavolt.toVolts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Volt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilovoltConversionTests = + [ + "To microvolts and back", (fun x -> x |> Kilovolt.toMicrovolts |> Microvolt.toKilovolts) + "To millivolts and back", (fun x -> x |> Kilovolt.toMillivolts |> Millivolt.toKilovolts) + "To volts and back", (fun x -> x |> Kilovolt.toVolts |> Volt.toKilovolts) + "To megavolts and back", (fun x -> x |> Kilovolt.toMegavolts |> Megavolt.toKilovolts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilovolt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megavoltConversionTests = + [ + "To microvolts and back", (fun x -> x |> Megavolt.toMicrovolts |> Microvolt.toMegavolts) + "To millivolts and back", (fun x -> x |> Megavolt.toMillivolts |> Millivolt.toMegavolts) + "To volts and back", (fun x -> x |> Megavolt.toVolts |> Volt.toMegavolts) + "To kilovolts and back", (fun x -> x |> Megavolt.toKilovolts |> Kilovolt.toMegavolts) + ] + |> List.map (fun (x, y) -> x, (fun z -> Megavolt.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Electromotive force tests" + [ + testList "Microvolt conversion tests" microvoltConversionTests + testList "Millivolt conversions" millivoltConversionTests + testList "Volt conversions" voltConversionTests + testList "Kilovolt conversions" kilovoltConversionTests + testList "Megavolt conversions" megavoltConversionTests + ] + +let inductanceTests config = + + let microHenryConversionTest = + [ + "To milli Henry and back", (fun x -> x |> MicroHenry.toMilliHenrys |> MilliHenry.toMicroHenrys) + "To Henry and back", (fun x -> x |> MicroHenry.toHenrys |> Henry.toMicroHenrys) + ] + |> List.map (fun (x, y) -> x, (fun z -> MicroHenry.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let milliHenryConversionTest = + [ + "To micro Henry and back", (fun x -> x |> MilliHenry.toMicroHenrys |> MicroHenry.toMilliHenrys) + "To Henry and back", (fun x -> x |> MilliHenry.toHenrys |> Henry.toMilliHenrys) + ] + |> List.map (fun (x, y) -> x, (fun z -> MilliHenry.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let henryConversionTest = + [ + "To micro Henry and back", (fun x -> x |> Henry.toMicroHenrys |> MicroHenry.toHenrys) + "To milli Henry and back", (fun x -> x |> Henry.toMilliHenrys |> MilliHenry.toHenrys) + ] + |> List.map (fun (x, y) -> x, (fun z -> Henry.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Inductance tests" + [ + testList "MicroHenry conversion tests" microHenryConversionTest + testList "MilliHenry conversions" milliHenryConversionTest + testList "Henry conversions" henryConversionTest + ] diff --git a/Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj b/tests/Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj similarity index 69% rename from Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj rename to tests/Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj index 6a0cfff..c4d6948 100644 --- a/Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj +++ b/tests/Fs.Units.Tests.Unit/Fs.Units.Tests.Unit.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false Fs.Tests.Unit @@ -11,9 +11,10 @@ + - + - + \ No newline at end of file diff --git a/tests/Fs.Units.Tests.Unit/Helpers.fs b/tests/Fs.Units.Tests.Unit/Helpers.fs new file mode 100644 index 0000000..74f0269 --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/Helpers.fs @@ -0,0 +1,26 @@ +module Helpers + +open FsCheck +open Expecto + +let testRange f value = + let inRange v = (v > -1E+10) && (v < 1E+10) + inRange value ==> lazy (f value) + +let removeUnits<[] 'u> value = float value + +let unwrapFloat a = + match a with + | NormalFloat v -> v + +let testNormalFloat x f = + let y = x |> unwrapFloat + f y + +let testConversionRoundingError config accuracy testName (f: float -> float<'Measure>) = + testPropertyWithConfig config testName + <| fun (input: NormalFloat) -> + testNormalFloat input + <| fun x -> + let convert = f x + Expect.floatClose accuracy (float convert) x "There is some rounding error" diff --git a/tests/Fs.Units.Tests.Unit/Main.fs b/tests/Fs.Units.Tests.Unit/Main.fs new file mode 100644 index 0000000..80e0dd3 --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/Main.fs @@ -0,0 +1,39 @@ +module Fs.Units.Tests + +open Expecto + +[] +let tests = + let config = FsCheckConfig.defaultConfig + + [ + SimpleUnitOfMeasureTests.lengthTests + SimpleUnitOfMeasureTests.timeTests + SimpleUnitOfMeasureTests.massTests + SimpleUnitOfMeasureTests.temperatureTests + SimpleUnitOfMeasureTests.angleTests + SimpleUnitOfMeasureTests.dataStorageTests + SimpleUnitOfMeasureTests.fuelEconomyTests + SimpleUnitOfMeasureTests.frequencyTests + SimpleUnitOfMeasureTests.illuminanceTests + SimpleUnitOfMeasureTests.currentTests + CompoundUnitOfMeasureTests.areaTests + CompoundUnitOfMeasureTests.volumeTests + CompoundUnitOfMeasureTests.inertiaTests + CompoundUnitOfMeasureTests.speedTests + CompoundUnitOfMeasureTests.forceTests + CompoundUnitOfMeasureTests.dataTransferRateTests + CompoundUnitOfMeasureTests.densityTests + CompoundUnitOfMeasureTests.pressureTests + CompoundUnitOfMeasureTests.powerTests + CompoundUnitOfMeasureTests.energyTests + CompoundUnitOfMeasureTests.electricChargeTests + CompoundUnitOfMeasureTests.electromotiveForceTests + CompoundUnitOfMeasureTests.inductanceTests + ] + |> List.map (fun x -> x config) + |> testList "Fs.Unit" + +[] +let main _ = + runTestsWithCLIArgs [] Array.empty tests diff --git a/tests/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs b/tests/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs new file mode 100644 index 0000000..4c3dc8b --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/SimpleUnitsOfMeasureTests.fs @@ -0,0 +1,1202 @@ +module SimpleUnitOfMeasureTests + +open Expecto +open Fs.Units +open Helpers + +let lengthTests config = + let inchConversionTests = + [ + "To feet and back", (fun x -> x |> Inch.toFeet |> Foot.toInches) + "To yard and back", (fun x -> x |> Inch.toYards |> Yard.toInches) + "To mile and back", (fun x -> x |> Inch.toMiles |> Mile.toInches) + "To millimeter and back", (fun x -> x |> Inch.toMillimeters |> Millimeter.toInches) + "To centimeter and back", (fun x -> x |> Inch.toCentimeters |> Centimeter.toInches) + "To decimeter and back", (fun x -> x |> Inch.toDecimeters |> Decimeter.toInches) + "To meter and back", (fun x -> x |> Inch.toMeters |> Meter.toInches) + "To kilometer and back", (fun x -> x |> Inch.toKilometers |> Kilometer.toInches) + "To nautical mile and back", (fun x -> x |> Inch.toNauticalMiles |> NauticalMile.toInches) + "To chain and back", (fun x -> x |> Inch.toChains |> Chain.toInches) + "To furlong and back", (fun x -> x |> Inch.toFurlongs |> Furlong.toInches) + "To league and back", (fun x -> x |> Inch.toLeagues |> League.toInches) + "To hand and back", (fun x -> x |> Inch.toHands |> Hand.toInches) + "To rod and back", (fun x -> x |> Inch.toRods |> Rod.toInches) + ] + |> List.map (fun (x, y) -> x, (fun z -> Inch.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let footConversionTests = + [ + "To inches and back", (fun x -> x |> Foot.toInches |> Inch.toFeet) + "To yard and back", (fun x -> x |> Foot.toYards |> Yard.toFeet) + "To mile and back", (fun x -> x |> Foot.toMiles |> Mile.toFeet) + "To millimeter and back", (fun x -> x |> Foot.toMillimeters |> Millimeter.toFeet) + "To centimeter and back", (fun x -> x |> Foot.toCentimeters |> Centimeter.toFeet) + "To decimeter and back", (fun x -> x |> Foot.toDecimeters |> Decimeter.toFeet) + "To meter and back", (fun x -> x |> Foot.toMeters |> Meter.toFeet) + "To kilometer and back", (fun x -> x |> Foot.toKilometers |> Kilometer.toFeet) + "To nautical mile and back", (fun x -> x |> Foot.toNauticalMiles |> NauticalMile.toFeet) + "To chain and back", (fun x -> x |> Foot.toChains |> Chain.toFeet) + "To furlong and back", (fun x -> x |> Foot.toFurlongs |> Furlong.toFeet) + "To league and back", (fun x -> x |> Foot.toLeagues |> League.toFeet) + "To hand and back", (fun x -> x |> Foot.toHands |> Hand.toFeet) + "To rod and back", (fun x -> x |> Foot.toRods |> Rod.toFeet) + ] + |> List.map (fun (x, y) -> x, (fun z -> Foot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let yardConversionTests = + [ + "To inches and back", (fun x -> x |> Yard.toInches |> Inch.toYards) + "To foot and back", (fun x -> x |> Yard.toFeet |> Foot.toYards) + "To mile and back", (fun x -> x |> Yard.toMiles |> Mile.toYards) + "To millimeter and back", (fun x -> x |> Yard.toMillimeters |> Millimeter.toYards) + "To centimeter and back", (fun x -> x |> Yard.toCentimeters |> Centimeter.toYards) + "To decimeter and back", (fun x -> x |> Yard.toDecimeters |> Decimeter.toYards) + "To meter and back", (fun x -> x |> Yard.toMeters |> Meter.toYards) + "To kilometer and back", (fun x -> x |> Yard.toKilometers |> Kilometer.toYards) + "To nautical mile and back", (fun x -> x |> Yard.toNauticalMiles |> NauticalMile.toYards) + "To chain and back", (fun x -> x |> Yard.toChains |> Chain.toYards) + "To furlong and back", (fun x -> x |> Yard.toFurlongs |> Furlong.toYards) + "To league and back", (fun x -> x |> Yard.toLeagues |> League.toYards) + "To hand and back", (fun x -> x |> Yard.toHands |> Hand.toYards) + "To rod and back", (fun x -> x |> Yard.toRods |> Rod.toYards) + ] + |> List.map (fun (x, y) -> x, (fun z -> Yard.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let mileConversionTests = + [ + "To inches and back", (fun x -> x |> Mile.toInches |> Inch.toMiles) + "To foot and back", (fun x -> x |> Mile.toFeet |> Foot.toMiles) + "To yard and back", (fun x -> x |> Mile.toYards |> Yard.toMiles) + "To millimeter and back", (fun x -> x |> Mile.toMillimeters |> Millimeter.toMiles) + "To centimeter and back", (fun x -> x |> Mile.toCentimeters |> Centimeter.toMiles) + "To decimeter and back", (fun x -> x |> Mile.toDecimeters |> Decimeter.toMiles) + "To meter and back", (fun x -> x |> Mile.toMeters |> Meter.toMiles) + "To kilometer and back", (fun x -> x |> Mile.toKilometers |> Kilometer.toMiles) + "To nautical mile and back", (fun x -> x |> Mile.toNauticalMiles |> NauticalMile.toMiles) + "To chain and back", (fun x -> x |> Mile.toChains |> Chain.toMiles) + "To furlong and back", (fun x -> x |> Mile.toFurlongs |> Furlong.toMiles) + "To league and back", (fun x -> x |> Mile.toLeagues |> League.toMiles) + "To hand and back", (fun x -> x |> Mile.toHands |> Hand.toMiles) + "To rod and back", (fun x -> x |> Mile.toRods |> Rod.toMiles) + ] + |> List.map (fun (x, y) -> x, (fun z -> Mile.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let millimeterConversionTests = + [ + "To inch and back", (fun x -> x |> Millimeter.toInches |> Inch.toMillimeters) + "To foot and back", (fun x -> x |> Millimeter.toFeet |> Foot.toMillimeters) + "To yard and back", (fun x -> x |> Millimeter.toYards |> Yard.toMillimeters) + "To mile and back", (fun x -> x |> Millimeter.toMiles |> Mile.toMillimeters) + "To centimeter and back", (fun x -> x |> Millimeter.toCentimeters |> Centimeter.toMillimeters) + "To decimeter and back", (fun x -> x |> Millimeter.toDecimeters |> Decimeter.toMillimeters) + "To meter and back", (fun x -> x |> Millimeter.toMeters |> Meter.toMillimeters) + "To kilometer and back", (fun x -> x |> Millimeter.toKilometers |> Kilometer.toMillimeters) + "To nautical mile and back", (fun x -> x |> Millimeter.toNauticalMiles |> NauticalMile.toMillimeters) + "To chain and back", (fun x -> x |> Millimeter.toChains |> Chain.toMillimeters) + "To furlong and back", (fun x -> x |> Millimeter.toFurlongs |> Furlong.toMillimeters) + "To league and back", (fun x -> x |> Millimeter.toLeagues |> League.toMillimeters) + "To hand and back", (fun x -> x |> Millimeter.toHands |> Hand.toMillimeters) + "To rod and back", (fun x -> x |> Millimeter.toRods |> Rod.toMillimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> Millimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let centimeterConversionTests = + [ + "To inch and back", (fun x -> x |> Centimeter.toInches |> Inch.toCentimeters) + "To foot and back", (fun x -> x |> Centimeter.toFeet |> Foot.toCentimeters) + "To yard and back", (fun x -> x |> Centimeter.toYards |> Yard.toCentimeters) + "To mile and back", (fun x -> x |> Centimeter.toMiles |> Mile.toCentimeters) + "To millimeter and back", (fun x -> x |> Centimeter.toMillimeters |> Millimeter.toCentimeters) + "To decimeter and back", (fun x -> x |> Centimeter.toDecimeters |> Decimeter.toCentimeters) + "To meter and back", (fun x -> x |> Centimeter.toMeters |> Meter.toCentimeters) + "To kilometer and back", (fun x -> x |> Centimeter.toKilometers |> Kilometer.toCentimeters) + "To nautical mile and back", (fun x -> x |> Centimeter.toNauticalMiles |> NauticalMile.toCentimeters) + "To chain and back", (fun x -> x |> Centimeter.toChains |> Chain.toCentimeters) + "To furlong and back", (fun x -> x |> Centimeter.toFurlongs |> Furlong.toCentimeters) + "To league and back", (fun x -> x |> Centimeter.toLeagues |> League.toCentimeters) + "To hand and back", (fun x -> x |> Centimeter.toHands |> Hand.toCentimeters) + "To rod and back", (fun x -> x |> Centimeter.toRods |> Rod.toCentimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> Centimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let decimeterConversionTests = + [ + "To inches and back", (fun x -> x |> Decimeter.toInches |> Inch.toDecimeters) + "To foot and back", (fun x -> x |> Decimeter.toFeet |> Foot.toDecimeters) + "To yard and back", (fun x -> x |> Decimeter.toYards |> Yard.toDecimeters) + "To mile and back", (fun x -> x |> Decimeter.toMiles |> Mile.toDecimeters) + "To millimeter and back", (fun x -> x |> Decimeter.toMillimeters |> Millimeter.toDecimeters) + "To centimeter and back", (fun x -> x |> Decimeter.toCentimeters |> Centimeter.toDecimeters) + "To meter and back", (fun x -> x |> Decimeter.toMeters |> Meter.toDecimeters) + "To kilometer and back", (fun x -> x |> Decimeter.toKilometers |> Kilometer.toDecimeters) + "To nautical mile and back", (fun x -> x |> Decimeter.toNauticalMiles |> NauticalMile.toDecimeters) + "To chain and back", (fun x -> x |> Decimeter.toChains |> Chain.toDecimeters) + "To furlong and back", (fun x -> x |> Decimeter.toFurlongs |> Furlong.toDecimeters) + "To league and back", (fun x -> x |> Decimeter.toLeagues |> League.toDecimeters) + "To hand and back", (fun x -> x |> Decimeter.toHands |> Hand.toDecimeters) + "To rod and back", (fun x -> x |> Decimeter.toRods |> Rod.toDecimeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> Decimeter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let meterConversionTests = + [ + "To inches and back", (fun x -> x |> Meter.toInches |> Inch.toMeters) + "To foot and back", (fun x -> x |> Meter.toFeet |> Foot.toMeters) + "To yard and back", (fun x -> x |> Meter.toYards |> Yard.toMeters) + "To mile and back", (fun x -> x |> Meter.toMiles |> Mile.toMeters) + "To millimeter and back", (fun x -> x |> Meter.toMillimeters |> Millimeter.toMeters) + "To centimeter and back", (fun x -> x |> Meter.toCentimeters |> Centimeter.toMeters) + "To kilometer and back", (fun x -> x |> Meter.toKilometers |> Kilometer.toMeters) + "To nautical mile and back", (fun x -> x |> Meter.toNauticalMiles |> NauticalMile.toMeters) + "To chain and back", (fun x -> x |> Meter.toChains |> Chain.toMeters) + "To furlong and back", (fun x -> x |> Meter.toFurlongs |> Furlong.toMeters) + "To league and back", (fun x -> x |> Meter.toLeagues |> League.toMeters) + "To hand and back", (fun x -> x |> Meter.toHands |> Hand.toMeters) + "To rod and back", (fun x -> x |> Meter.toRods |> Rod.toMeters) + ] + |> List.map (fun (x, y) -> x, (fun z -> Meter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilometerConversionTests = + [ + "To inches and back", (fun x -> x |> Kilometer.toInches |> Inch.toKilometers) + "To foot and back", (fun x -> x |> Kilometer.toFeet |> Foot.toKilometers) + "To yard and back", (fun x -> x |> Kilometer.toYards |> Yard.toKilometers) + "To mile and back", (fun x -> x |> Kilometer.toMiles |> Mile.toKilometers) + "To millimeter and back", (fun x -> x |> Kilometer.toMillimeters |> Millimeter.toKilometers) + "To centimeter and back", (fun x -> x |> Kilometer.toCentimeters |> Centimeter.toKilometers) + "To meter and back", (fun x -> x |> Kilometer.toMeters |> Meter.toKilometers) + "To nautical mile and back", (fun x -> x |> Kilometer.toNauticalMiles |> NauticalMile.toKilometers) + "To chain and back", (fun x -> x |> Kilometer.toChains |> Chain.toKilometers) + "To furlong and back", (fun x -> x |> Kilometer.toFurlongs |> Furlong.toKilometers) + "To league and back", (fun x -> x |> Kilometer.toLeagues |> League.toKilometers) + "To hand and back", (fun x -> x |> Kilometer.toHands |> Hand.toKilometers) + "To rod and back", (fun x -> x |> Kilometer.toRods |> Rod.toKilometers) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilometer.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let nauticalMileConversionTests = + [ + "From nautical mile to inches and back", (fun x -> x |> NauticalMile.toInches |> Inch.toNauticalMiles) + "From nautical mile to foot and back", (fun x -> x |> NauticalMile.toFeet |> Foot.toNauticalMiles) + "From nautical mile to yard and back", (fun x -> x |> NauticalMile.toYards |> Yard.toNauticalMiles) + "From nautical mile to mile and back", (fun x -> x |> NauticalMile.toMiles |> Mile.toNauticalMiles) + "From nautical mile to millimeter and back", + (fun x -> x |> NauticalMile.toMillimeters |> Millimeter.toNauticalMiles) + "From nautical mile to centimeter and back", + (fun x -> x |> NauticalMile.toCentimeters |> Centimeter.toNauticalMiles) + "From nautical mile to meter and back", (fun x -> x |> NauticalMile.toMeters |> Meter.toNauticalMiles) + "From nautical mile to kilometer and back", (fun x -> x |> NauticalMile.toKilometers |> Kilometer.toNauticalMiles) + "From nautical mile to chain and back", (fun x -> x |> NauticalMile.toChains |> Chain.toNauticalMiles) + "From nautical mile to furlong and back", (fun x -> x |> NauticalMile.toFurlongs |> Furlong.toNauticalMiles) + "From nautical mile to league and back", (fun x -> x |> NauticalMile.toLeagues |> League.toNauticalMiles) + "From nautical mile to hand and back", (fun x -> x |> NauticalMile.toHands |> Hand.toNauticalMiles) + "From nautical mile to rod and back", (fun x -> x |> NauticalMile.toRods |> Rod.toNauticalMiles) + ] + |> List.map (fun (x, y) -> x, (fun z -> NauticalMile.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let chainConversionTests = + [ + "To inches and back", (fun x -> x |> Chain.toInches |> Inch.toChains) + "To foot and back", (fun x -> x |> Chain.toFeet |> Foot.toChains) + "To yard and back", (fun x -> x |> Chain.toYards |> Yard.toChains) + "To mile and back", (fun x -> x |> Chain.toMiles |> Mile.toChains) + "To millimeter and back", (fun x -> x |> Chain.toMillimeters |> Millimeter.toChains) + "To centimeter and back", (fun x -> x |> Chain.toCentimeters |> Centimeter.toChains) + "To meter and back", (fun x -> x |> Chain.toMeters |> Meter.toChains) + "To kilometer and back", (fun x -> x |> Chain.toKilometers |> Kilometer.toChains) + "To nautical mile and back", (fun x -> x |> Chain.toNauticalMiles |> NauticalMile.toChains) + "To furlong and back", (fun x -> x |> Chain.toFurlongs |> Furlong.toChains) + "To league and back", (fun x -> x |> Chain.toLeagues |> League.toChains) + "To hand and back", (fun x -> x |> Chain.toHands |> Hand.toChains) + "To rod and back", (fun x -> x |> Chain.toRods |> Rod.toChains) + ] + |> List.map (fun (x, y) -> x, (fun z -> Chain.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let furlongConversionTests = + [ + "To inches and back", (fun x -> x |> Furlong.toInches |> Inch.toFurlongs) + "To foot and back", (fun x -> x |> Furlong.toFeet |> Foot.toFurlongs) + "To yard and back", (fun x -> x |> Furlong.toYards |> Yard.toFurlongs) + "To mile and back", (fun x -> x |> Furlong.toMiles |> Mile.toFurlongs) + "To millimeter and back", (fun x -> x |> Furlong.toMillimeters |> Millimeter.toFurlongs) + "To centimeter and back", (fun x -> x |> Furlong.toCentimeters |> Centimeter.toFurlongs) + "To meter and back", (fun x -> x |> Furlong.toMeters |> Meter.toFurlongs) + "To kilometer and back", (fun x -> x |> Furlong.toKilometers |> Kilometer.toFurlongs) + "To nautical mile and back", (fun x -> x |> Furlong.toNauticalMiles |> NauticalMile.toFurlongs) + "To chain and back", (fun x -> x |> Furlong.toChains |> Chain.toFurlongs) + "To league and back", (fun x -> x |> Furlong.toLeagues |> League.toFurlongs) + "To hand and back", (fun x -> x |> Furlong.toHands |> Hand.toFurlongs) + "To rod and back", (fun x -> x |> Furlong.toRods |> Rod.toFurlongs) + ] + |> List.map (fun (x, y) -> x, (fun z -> Furlong.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let leagueConversionTests = + [ + "To inches and back", (fun x -> x |> League.toInches |> Inch.toLeagues) + "To foot and back", (fun x -> x |> League.toFeet |> Foot.toLeagues) + "To yard and back", (fun x -> x |> League.toYards |> Yard.toLeagues) + "To mile and back", (fun x -> x |> League.toMiles |> Mile.toLeagues) + "To millimeter and back", (fun x -> x |> League.toMillimeters |> Millimeter.toLeagues) + "To centimeter and back", (fun x -> x |> League.toCentimeters |> Centimeter.toLeagues) + "To meter and back", (fun x -> x |> League.toMeters |> Meter.toLeagues) + "To kilometer and back", (fun x -> x |> League.toKilometers |> Kilometer.toLeagues) + "To nautical mile and back", (fun x -> x |> League.toNauticalMiles |> NauticalMile.toLeagues) + "To chain and back", (fun x -> x |> League.toChains |> Chain.toLeagues) + "To furlong and back", (fun x -> x |> League.toFurlongs |> Furlong.toLeagues) + "To hand and back", (fun x -> x |> League.toHands |> Hand.toLeagues) + "To rod and back", (fun x -> x |> League.toRods |> Rod.toLeagues) + ] + |> List.map (fun (x, y) -> x, (fun z -> League.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let handConversionTests = + [ + "To inches and back", (fun x -> x |> Hand.toInches |> Inch.toHands) + "To foot and back", (fun x -> x |> Hand.toFeet |> Foot.toHands) + "To yard and back", (fun x -> x |> Hand.toYards |> Yard.toHands) + "To mile and back", (fun x -> x |> Hand.toMiles |> Mile.toHands) + "To millimeter and back", (fun x -> x |> Hand.toMillimeters |> Millimeter.toHands) + "To centimeter and back", (fun x -> x |> Hand.toCentimeters |> Centimeter.toHands) + "To meter and back", (fun x -> x |> Hand.toMeters |> Meter.toHands) + "To kilometer and back", (fun x -> x |> Hand.toKilometers |> Kilometer.toHands) + "To nautical mile and back", (fun x -> x |> Hand.toNauticalMiles |> NauticalMile.toHands) + "To chain and back", (fun x -> x |> Hand.toChains |> Chain.toHands) + "To furlong and back", (fun x -> x |> Hand.toFurlongs |> Furlong.toHands) + "To league and back", (fun x -> x |> Hand.toLeagues |> League.toHands) + "To rod and back", (fun x -> x |> Hand.toRods |> Rod.toHands) + ] + |> List.map (fun (x, y) -> x, (fun z -> Hand.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let rodConversionTests = + [ + "To inches and back", (fun x -> x |> Rod.toInches |> Inch.toRods) + "To foot and back", (fun x -> x |> Rod.toFeet |> Foot.toRods) + "To yard and back", (fun x -> x |> Rod.toYards |> Yard.toRods) + "To mile and back", (fun x -> x |> Rod.toMiles |> Mile.toRods) + "To millimeter and back", (fun x -> x |> Rod.toMillimeters |> Millimeter.toRods) + "To centimeter and back", (fun x -> x |> Rod.toCentimeters |> Centimeter.toRods) + "To meter and back", (fun x -> x |> Rod.toMeters |> Meter.toRods) + "To kilometer and back", (fun x -> x |> Rod.toKilometers |> Kilometer.toRods) + "To nautical mile and back", (fun x -> x |> Rod.toNauticalMiles |> NauticalMile.toRods) + "To chain and back", (fun x -> x |> Rod.toChains |> Chain.toRods) + "To furlong and back", (fun x -> x |> Rod.toFurlongs |> Furlong.toRods) + "To league and back", (fun x -> x |> Rod.toLeagues |> League.toRods) + "To hand and back", (fun x -> x |> Rod.toHands |> Hand.toRods) + ] + |> List.map (fun (x, y) -> x, (fun z -> Rod.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Length Tests" + [ + testList "Convert inch to other and back" inchConversionTests + testList "Convert foot to other and back" footConversionTests + testList "Convert yard to other and back" yardConversionTests + testList "Convert mile to other and back" mileConversionTests + testList "Convert millimeter to other and back" millimeterConversionTests + testList "Convert centimeter to other and back" centimeterConversionTests + testList "Convert decimeter to other and back" decimeterConversionTests + testList "Convert meter to other and back" meterConversionTests + testList "Convert kilometer to other and back" kilometerConversionTests + testList "Convert nautical mile to other and back" nauticalMileConversionTests + testList "Convert chain to other and back" chainConversionTests + testList "Convert furlong to other and back" furlongConversionTests + testList "Convert league to other and back" leagueConversionTests + testList "Convert hand to other and back" handConversionTests + testList "Convert rod to other and back" rodConversionTests + ] + +let timeTests config = + + let nanoSecondConversionTests = + [ + "To microsecond and back", (fun x -> x |> Nanosecond.toMicroSeconds |> Microsecond.toNanoSeconds) + "To millisecond and back", (fun x -> x |> Nanosecond.toMilliSeconds |> Millisecond.toNanoSeconds) + "To second and back", (fun x -> x |> Nanosecond.toSeconds |> Second.toNanoSeconds) + "To minute and back", (fun x -> x |> Nanosecond.toMinutes |> Minute.toNanoSeconds) + "To hour and back", (fun x -> x |> Nanosecond.toHours |> Hour.toNanoSeconds) + "To day and back", (fun x -> x |> Nanosecond.toDays |> Day.toNanoSeconds) + "To week and back", (fun x -> x |> Nanosecond.toWeeks |> Week.toNanoSeconds) + "To fortnight and back", (fun x -> x |> Nanosecond.toFortnights |> Fortnight.toNanoSeconds) + "To month and back", (fun x -> x |> Nanosecond.toMonths |> Month.toNanoSeconds) + "To year and back", (fun x -> x |> Nanosecond.toYears |> Year.toNanoSeconds) + "To decade and back", (fun x -> x |> Nanosecond.toDecades |> Decade.toNanoSeconds) + "To century and back", (fun x -> x |> Nanosecond.toCenturies |> Century.toNanoSeconds) + "To millennium and back", (fun x -> x |> Nanosecond.toMillennia |> Millennium.toNanoSeconds) + "To eon and back", (fun x -> x |> Nanosecond.toEons |> Eon.toNanoSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> Nanosecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let microSecondConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Microsecond.toNanoSeconds |> Nanosecond.toMicroSeconds) + "To millisecond and back", (fun x -> x |> Microsecond.toMilliSeconds |> Millisecond.toMicroSeconds) + "To second and back", (fun x -> x |> Microsecond.toSeconds |> Second.toMicroSeconds) + "To minute and back", (fun x -> x |> Microsecond.toMinutes |> Minute.toMicroSeconds) + "To hour and back", (fun x -> x |> Microsecond.toHours |> Hour.toMicroSeconds) + "To day and back", (fun x -> x |> Microsecond.toDays |> Day.toMicroSeconds) + "To week and back", (fun x -> x |> Microsecond.toWeeks |> Week.toMicroSeconds) + "To fortnight and back", (fun x -> x |> Microsecond.toFortnights |> Fortnight.toMicroSeconds) + "To month and back", (fun x -> x |> Microsecond.toMonths |> Month.toMicroSeconds) + "To year and back", (fun x -> x |> Microsecond.toYears |> Year.toMicroSeconds) + "To decade and back", (fun x -> x |> Microsecond.toDecades |> Decade.toMicroSeconds) + "To century and back", (fun x -> x |> Microsecond.toCenturies |> Century.toMicroSeconds) + "To millennium and back", (fun x -> x |> Microsecond.toMillennia |> Millennium.toMicroSeconds) + "To eon and back", (fun x -> x |> Microsecond.toEons |> Eon.toMicroSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> Microsecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let milliSecondConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Millisecond.toNanoSeconds |> Nanosecond.toMilliSeconds) + "To microsecond and back", (fun x -> x |> Millisecond.toMicroSeconds |> Microsecond.toMilliSeconds) + "To second and back", (fun x -> x |> Millisecond.toSeconds |> Second.toMilliSeconds) + "To minute and back", (fun x -> x |> Millisecond.toMinutes |> Minute.toMilliSeconds) + "To hour and back", (fun x -> x |> Millisecond.toHours |> Hour.toMilliSeconds) + "To day and back", (fun x -> x |> Millisecond.toDays |> Day.toMilliSeconds) + "To week and back", (fun x -> x |> Millisecond.toWeeks |> Week.toMilliSeconds) + "To fortnight and back", (fun x -> x |> Millisecond.toFortnights |> Fortnight.toMilliSeconds) + "To month and back", (fun x -> x |> Millisecond.toMonths |> Month.toMilliSeconds) + "To year and back", (fun x -> x |> Millisecond.toYears |> Year.toMilliSeconds) + "To decade and back", (fun x -> x |> Millisecond.toDecades |> Decade.toMilliSeconds) + "To century and back", (fun x -> x |> Millisecond.toCenturies |> Century.toMilliSeconds) + "To millennium and back", (fun x -> x |> Millisecond.toMillennia |> Millennium.toMilliSeconds) + "To eon and back", (fun x -> x |> Millisecond.toEons |> Eon.toMilliSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> Millisecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let secondConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Second.toNanoSeconds |> Nanosecond.toSeconds) + "To microsecond and back", (fun x -> x |> Second.toMicroSeconds |> Microsecond.toSeconds) + "To millisecond and back", (fun x -> x |> Second.toMilliSeconds |> Millisecond.toSeconds) + "To minute and back", (fun x -> x |> Second.toMinutes |> Minute.toSeconds) + "To hour and back", (fun x -> x |> Second.toHours |> Hour.toSeconds) + "To day and back", (fun x -> x |> Second.toDays |> Day.toSeconds) + "To week and back", (fun x -> x |> Second.toWeeks |> Week.toSeconds) + "To fortnight and back", (fun x -> x |> Second.toFortnights |> Fortnight.toSeconds) + "To month and back", (fun x -> x |> Second.toMonths |> Month.toSeconds) + "To year and back", (fun x -> x |> Second.toYears |> Year.toSeconds) + "To decade and back", (fun x -> x |> Second.toDecades |> Decade.toSeconds) + "To century and back", (fun x -> x |> Second.toCenturies |> Century.toSeconds) + "To millennium and back", (fun x -> x |> Second.toMillennia |> Millennium.toSeconds) + "To eon and back", (fun x -> x |> Second.toEons |> Eon.toSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> Second.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let minuteConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Minute.toNanoSeconds |> Nanosecond.toMinutes) + "To microsecond and back", (fun x -> x |> Minute.toMicroSeconds |> Microsecond.toMinutes) + "To millisecond and back", (fun x -> x |> Minute.toMilliSeconds |> Millisecond.toMinutes) + "To second and back", (fun x -> x |> Minute.toSeconds |> Second.toMinutes) + "To hour and back", (fun x -> x |> Minute.toHours |> Hour.toMinutes) + "To day and back", (fun x -> x |> Minute.toDays |> Day.toMinutes) + "To week and back", (fun x -> x |> Minute.toWeeks |> Week.toMinutes) + "To fortnight and back", (fun x -> x |> Minute.toFortnights |> Fortnight.toMinutes) + "To month and back", (fun x -> x |> Minute.toMonths |> Month.toMinutes) + "To year and back", (fun x -> x |> Minute.toYears |> Year.toMinutes) + "To decade and back", (fun x -> x |> Minute.toDecades |> Decade.toMinutes) + "To century and back", (fun x -> x |> Minute.toCenturies |> Century.toMinutes) + "To millennium and back", (fun x -> x |> Minute.toMillennia |> Millennium.toMinutes) + "To eon and back", (fun x -> x |> Minute.toEons |> Eon.toMinutes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Minute.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let hourConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Hour.toNanoSeconds |> Nanosecond.toHours) + "To microsecond and back", (fun x -> x |> Hour.toMicroSeconds |> Microsecond.toHours) + "To millisecond and back", (fun x -> x |> Hour.toMilliSeconds |> Millisecond.toHours) + "To second and back", (fun x -> x |> Hour.toSeconds |> Second.toHours) + "To minute and back", (fun x -> x |> Hour.toMinutes |> Minute.toHours) + "To day and back", (fun x -> x |> Hour.toDays |> Day.toHours) + "To week and back", (fun x -> x |> Hour.toWeeks |> Week.toHours) + "To fortnight and back", (fun x -> x |> Hour.toFortnights |> Fortnight.toHours) + "To month and back", (fun x -> x |> Hour.toMonths |> Month.toHours) + "To year and back", (fun x -> x |> Hour.toYears |> Year.toHours) + "To decade and back", (fun x -> x |> Hour.toDecades |> Decade.toHours) + "To century and back", (fun x -> x |> Hour.toCenturies |> Century.toHours) + "To millennium and back", (fun x -> x |> Hour.toMillennia |> Millennium.toHours) + "To eon and back", (fun x -> x |> Hour.toEons |> Eon.toHours) + ] + |> List.map (fun (x, y) -> x, (fun z -> Hour.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let dayConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Day.toNanoSeconds |> Nanosecond.toDays) + "To microsecond and back", (fun x -> x |> Day.toMicroSeconds |> Microsecond.toDays) + "To millisecond and back", (fun x -> x |> Day.toMilliSeconds |> Millisecond.toDays) + "To second and back", (fun x -> x |> Day.toSeconds |> Second.toDays) + "To minute and back", (fun x -> x |> Day.toMinutes |> Minute.toDays) + "To hour and back", (fun x -> x |> Day.toHours |> Hour.toDays) + "To week and back", (fun x -> x |> Day.toWeeks |> Week.toDays) + "To fortnight and back", (fun x -> x |> Day.toFortnights |> Fortnight.toDays) + "To month and back", (fun x -> x |> Day.toMonths |> Month.toDays) + "To year and back", (fun x -> x |> Day.toYears |> Year.toDays) + "To decade and back", (fun x -> x |> Day.toDecades |> Decade.toDays) + "To century and back", (fun x -> x |> Day.toCenturies |> Century.toDays) + "To millennium and back", (fun x -> x |> Day.toMillennia |> Millennium.toDays) + "To eon and back", (fun x -> x |> Day.toEons |> Eon.toDays) + ] + |> List.map (fun (x, y) -> x, (fun z -> Day.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let weekConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Week.toNanoSeconds |> Nanosecond.toWeeks) + "To microsecond and back", (fun x -> x |> Week.toMicroSeconds |> Microsecond.toWeeks) + "To millisecond and back", (fun x -> x |> Week.toMilliSeconds |> Millisecond.toWeeks) + "To second and back", (fun x -> x |> Week.toSeconds |> Second.toWeeks) + "To minute and back", (fun x -> x |> Week.toMinutes |> Minute.toWeeks) + "To hour and back", (fun x -> x |> Week.toHours |> Hour.toWeeks) + "To day and back", (fun x -> x |> Week.toDays |> Day.toWeeks) + "To fortnight and back", (fun x -> x |> Week.toFortnights |> Fortnight.toWeeks) + "To month and back", (fun x -> x |> Week.toMonths |> Month.toWeeks) + "To year and back", (fun x -> x |> Week.toYears |> Year.toWeeks) + "To decade and back", (fun x -> x |> Week.toDecades |> Decade.toWeeks) + "To century and back", (fun x -> x |> Week.toCenturies |> Century.toWeeks) + "To millennium and back", (fun x -> x |> Week.toMillennia |> Millennium.toWeeks) + "To eon and back", (fun x -> x |> Week.toEons |> Eon.toWeeks) + ] + |> List.map (fun (x, y) -> x, (fun z -> Week.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let fortnightConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Fortnight.toNanoSeconds |> Nanosecond.toFortnights) + "To microsecond and back", (fun x -> x |> Fortnight.toMicroSeconds |> Microsecond.toFortnights) + "To millisecond and back", (fun x -> x |> Fortnight.toMilliSeconds |> Millisecond.toFortnights) + "To second and back", (fun x -> x |> Fortnight.toSeconds |> Second.toFortnights) + "To minute and back", (fun x -> x |> Fortnight.toMinutes |> Minute.toFortnights) + "To hour and back", (fun x -> x |> Fortnight.toHours |> Hour.toFortnights) + "To day and back", (fun x -> x |> Fortnight.toDays |> Day.toFortnights) + "To week and back", (fun x -> x |> Fortnight.toWeeks |> Week.toFortnights) + "To month and back", (fun x -> x |> Fortnight.toMonths |> Month.toFortnights) + "To year and back", (fun x -> x |> Fortnight.toYears |> Year.toFortnights) + "To decade and back", (fun x -> x |> Fortnight.toDecades |> Decade.toFortnights) + "To century and back", (fun x -> x |> Fortnight.toCenturies |> Century.toFortnights) + "To millennium and back", (fun x -> x |> Fortnight.toMillennia |> Millennium.toFortnights) + "To eon and back", (fun x -> x |> Fortnight.toEons |> Eon.toFortnights) + ] + |> List.map (fun (x, y) -> x, (fun z -> Fortnight.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let monthConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Month.toNanoSeconds |> Nanosecond.toMonths) + "To microsecond and back", (fun x -> x |> Month.toMicroSeconds |> Microsecond.toMonths) + "To millisecond and back", (fun x -> x |> Month.toMilliSeconds |> Millisecond.toMonths) + "To second and back", (fun x -> x |> Month.toSeconds |> Second.toMonths) + "To minute and back", (fun x -> x |> Month.toMinutes |> Minute.toMonths) + "To hour and back", (fun x -> x |> Month.toHours |> Hour.toMonths) + "To day and back", (fun x -> x |> Month.toDays |> Day.toMonths) + "To week and back", (fun x -> x |> Month.toWeeks |> Week.toMonths) + "To fortnight and back", (fun x -> x |> Month.toFortnights |> Fortnight.toMonths) + "To year and back", (fun x -> x |> Month.toYears |> Year.toMonths) + "To decade and back", (fun x -> x |> Month.toDecades |> Decade.toMonths) + "To century and back", (fun x -> x |> Month.toCenturies |> Century.toMonths) + "To millennium and back", (fun x -> x |> Month.toMillennia |> Millennium.toMonths) + "To eon and back", (fun x -> x |> Month.toEons |> Eon.toMonths) + ] + |> List.map (fun (x, y) -> x, (fun z -> Month.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let yearConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Year.toNanoSeconds |> Nanosecond.toYears) + "To microsecond and back", (fun x -> x |> Year.toMicroSeconds |> Microsecond.toYears) + "To millisecond and back", (fun x -> x |> Year.toMilliSeconds |> Millisecond.toYears) + "To second and back", (fun x -> x |> Year.toSeconds |> Second.toYears) + "To minute and back", (fun x -> x |> Year.toMinutes |> Minute.toYears) + "To hour and back", (fun x -> x |> Year.toHours |> Hour.toYears) + "To day and back", (fun x -> x |> Year.toDays |> Day.toYears) + "To week and back", (fun x -> x |> Year.toWeeks |> Week.toYears) + "To fortnight and back", (fun x -> x |> Year.toFortnights |> Fortnight.toYears) + "To month and back", (fun x -> x |> Year.toMonths |> Month.toYears) + "To decade and back", (fun x -> x |> Year.toDecades |> Decade.toYears) + "To century and back", (fun x -> x |> Year.toCenturies |> Century.toYears) + "To millennium and back", (fun x -> x |> Year.toMillennia |> Millennium.toYears) + "To eon and back", (fun x -> x |> Year.toEons |> Eon.toYears) + ] + |> List.map (fun (x, y) -> x, (fun z -> Year.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let decadeConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Decade.toNanoSeconds |> Nanosecond.toDecades) + "To microsecond and back", (fun x -> x |> Decade.toMicroSeconds |> Microsecond.toDecades) + "To millisecond and back", (fun x -> x |> Decade.toMilliSeconds |> Millisecond.toDecades) + "To second and back", (fun x -> x |> Decade.toSeconds |> Second.toDecades) + "To minute and back", (fun x -> x |> Decade.toMinutes |> Minute.toDecades) + "To hour and back", (fun x -> x |> Decade.toHours |> Hour.toDecades) + "To day and back", (fun x -> x |> Decade.toDays |> Day.toDecades) + "To week and back", (fun x -> x |> Decade.toWeeks |> Week.toDecades) + "To fortnight and back", (fun x -> x |> Decade.toFortnights |> Fortnight.toDecades) + "To month and back", (fun x -> x |> Decade.toMonths |> Month.toDecades) + "To year and back", (fun x -> x |> Decade.toYears |> Year.toDecades) + "To century and back", (fun x -> x |> Decade.toCenturies |> Century.toDecades) + "To millennium and back", (fun x -> x |> Decade.toMillennia |> Millennium.toDecades) + "To eon and back", (fun x -> x |> Decade.toEons |> Eon.toDecades) + ] + |> List.map (fun (x, y) -> x, (fun z -> Decade.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let centuryConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Century.toNanoSeconds |> Nanosecond.toCenturies) + "To microsecond and back", (fun x -> x |> Century.toMicroSeconds |> Microsecond.toCenturies) + "To millisecond and back", (fun x -> x |> Century.toMilliSeconds |> Millisecond.toCenturies) + "To second and back", (fun x -> x |> Century.toSeconds |> Second.toCenturies) + "To minute and back", (fun x -> x |> Century.toMinutes |> Minute.toCenturies) + "To hour and back", (fun x -> x |> Century.toHours |> Hour.toCenturies) + "To day and back", (fun x -> x |> Century.toDays |> Day.toCenturies) + "To week and back", (fun x -> x |> Century.toWeeks |> Week.toCenturies) + "To fortnight and back", (fun x -> x |> Century.toFortnights |> Fortnight.toCenturies) + "To month and back", (fun x -> x |> Century.toMonths |> Month.toCenturies) + "To year and back", (fun x -> x |> Century.toYears |> Year.toCenturies) + "To decade and back", (fun x -> x |> Century.toDecades |> Decade.toCenturies) + "To millennium and back", (fun x -> x |> Century.toMillennia |> Millennium.toCenturies) + "To eon and back", (fun x -> x |> Century.toEons |> Eon.toCenturies) + ] + |> List.map (fun (x, y) -> x, (fun z -> Century.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let millenniumConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Millennium.toNanoSeconds |> Nanosecond.toMillennia) + "To microsecond and back", (fun x -> x |> Millennium.toMicroSeconds |> Microsecond.toMillennia) + "To millisecond and back", (fun x -> x |> Millennium.toMilliSeconds |> Millisecond.toMillennia) + "To second and back", (fun x -> x |> Millennium.toSeconds |> Second.toMillennia) + "To minute and back", (fun x -> x |> Millennium.toMinutes |> Minute.toMillennia) + "To hour and back", (fun x -> x |> Millennium.toHours |> Hour.toMillennia) + "To day and back", (fun x -> x |> Millennium.toDays |> Day.toMillennia) + "To week and back", (fun x -> x |> Millennium.toWeeks |> Week.toMillennia) + "To fortnight and back", (fun x -> x |> Millennium.toFortnights |> Fortnight.toMillennia) + "To month and back", (fun x -> x |> Millennium.toMonths |> Month.toMillennia) + "To year and back", (fun x -> x |> Millennium.toYears |> Year.toMillennia) + "To decade and back", (fun x -> x |> Millennium.toDecades |> Decade.toMillennia) + "To century and back", (fun x -> x |> Millennium.toCenturies |> Century.toMillennia) + "To eon and back", (fun x -> x |> Millennium.toEons |> Eon.toMillennia) + ] + |> List.map (fun (x, y) -> x, (fun z -> Millennium.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let eonConversionTests = + [ + "To nanosecond and back", (fun x -> x |> Eon.toNanoSeconds |> Nanosecond.toEons) + "To microsecond and back", (fun x -> x |> Eon.toMicroSeconds |> Microsecond.toEons) + "To millisecond and back", (fun x -> x |> Eon.toMilliSeconds |> Millisecond.toEons) + "To second and back", (fun x -> x |> Eon.toSeconds |> Second.toEons) + "To minute and back", (fun x -> x |> Eon.toMinutes |> Minute.toEons) + "To hour and back", (fun x -> x |> Eon.toHours |> Hour.toEons) + "To day and back", (fun x -> x |> Eon.toDays |> Day.toEons) + "To week and back", (fun x -> x |> Eon.toWeeks |> Week.toEons) + "To fortnight and back", (fun x -> x |> Eon.toFortnights |> Fortnight.toEons) + "To month and back", (fun x -> x |> Eon.toMonths |> Month.toEons) + "To year and back", (fun x -> x |> Eon.toYears |> Year.toEons) + "To decade and back", (fun x -> x |> Eon.toDecades |> Decade.toEons) + "To century and back", (fun x -> x |> Eon.toCenturies |> Century.toEons) + "To millennium and back", (fun x -> x |> Eon.toMillennia |> Millennium.toEons) + ] + |> List.map (fun (x, y) -> x, (fun z -> Eon.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Time Tests" + [ + testList "Nanosecond conversions" nanoSecondConversionTests + testList "Microsecond conversions" microSecondConversionTests + testList "Millisecond conversions" milliSecondConversionTests + testList "Second conversions" secondConversionTests + testList "Minute conversions" minuteConversionTests + testList "Hour conversions" hourConversionTests + testList "Day conversions" dayConversionTests + testList "Week conversions" weekConversionTests + testList "Fortnight conversions" fortnightConversionTests + testList "Month conversions" monthConversionTests + testList "Year conversions" yearConversionTests + testList "Decade conversions" decadeConversionTests + testList "Century conversions" centuryConversionTests + testList "Millennium conversions" millenniumConversionTests + testList "Eon conversions" eonConversionTests + ] + +let massTests config = + + let milligramConversionTests = + [ + "To gram and back", (fun x -> x |> Milligram.toGrams |> Gram.toMilligrams) + "To kilogram and back", (fun x -> x |> Milligram.toKilograms |> Kilogram.toMilligrams) + "To pound and back", (fun x -> x |> Milligram.toPoundMass |> PoundMass.toMilligrams) + ] + |> List.map (fun (x, y) -> x, (fun z -> Milligram.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gramConversionTests = + [ + "To milligram and back", (fun x -> x |> Gram.toMilligrams |> Milligram.toGrams) + "To kilogram and back", (fun x -> x |> Gram.toKilograms |> Kilogram.toGrams) + "To pound and back", (fun x -> x |> Gram.toPoundMass |> PoundMass.toGrams) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gram.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilogramConversionTests = + [ + "To milligram and back", (fun x -> x |> Kilogram.toMilligrams |> Milligram.toKilograms) + "To gram and back", (fun x -> x |> Kilogram.toGrams |> Gram.toKilograms) + "To pound and back", (fun x -> x |> Kilogram.toPoundMass |> PoundMass.toKilograms) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilogram.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let poundConversionTests = + [ + "To milligram and back", (fun x -> x |> PoundMass.toMilligrams |> Milligram.toPoundMass) + "To gram and back", (fun x -> x |> PoundMass.toGrams |> Gram.toPoundMass) + "To kilogram and back", (fun x -> x |> PoundMass.toKilograms |> Kilogram.toPoundMass) + ] + |> List.map (fun (x, y) -> x, (fun z -> PoundMass.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Mass tests" + [ + testList "Milligram conversions" milligramConversionTests + testList "Gram conversions" gramConversionTests + testList "Kilogram conversions" kilogramConversionTests + testList "Pound conversions" poundConversionTests + ] + +let temperatureTests config = + + let kelvinConversionTests = + [ + "To celsius and back", (fun x -> x |> Kelvin.toCelsius |> Celsius.toKelvin) + "To fahrenheit and back", (fun x -> x |> Kelvin.toFahrenheit |> Fahrenheit.toKelvin) + "To rankine and back", (fun x -> x |> Kelvin.toRankine |> Rankine.toKelvin) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kelvin.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let celsiusConversionTests = + [ + "To kelvin and back", (fun x -> x |> Celsius.toKelvin |> Kelvin.toCelsius) + "To fahrenheit and back", (fun x -> x |> Celsius.toFahrenheit |> Fahrenheit.toCelsius) + "To rankine and back", (fun x -> x |> Celsius.toRankine |> Rankine.toCelsius) + ] + |> List.map (fun (x, y) -> x, (fun z -> Celsius.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let fahrenheitConversionTests = + [ + "To kelvin and back", (fun x -> x |> Fahrenheit.toKelvin |> Kelvin.toFahrenheit) + "To celsius and back", (fun x -> x |> Fahrenheit.toCelsius |> Celsius.toFahrenheit) + "To rankine and back", (fun x -> x |> Fahrenheit.toRankine |> Rankine.toFahrenheit) + ] + |> List.map (fun (x, y) -> x, (fun z -> Fahrenheit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let rankineConversionTests = + [ + "To kelvin and back", (fun x -> x |> Rankine.toKelvin |> Kelvin.toRankine) + "To celsius and back", (fun x -> x |> Rankine.toCelsius |> Celsius.toRankine) + "To fahrenheit and back", (fun x -> x |> Rankine.toFahrenheit |> Fahrenheit.toRankine) + ] + |> List.map (fun (x, y) -> x, (fun z -> Rankine.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Temperature Tests" + [ + testList "Kelvin conversions" kelvinConversionTests + testList "Celsius conversions" celsiusConversionTests + testList "Fahrenheit conversions" fahrenheitConversionTests + testList "Rankine conversions" rankineConversionTests + ] + +let angleTests config = + + let degreeConversionTests = + [ + "To radians and back", (fun x -> x |> Degree.toRadians |> Radian.toDegrees) + "To gradians and back", (fun x -> x |> Degree.toGradians |> Gradian.toDegrees) + "To revolutions and back", (fun x -> x |> Degree.toRevolutions |> Revolution.toDegrees) + "To arcminutes and back", (fun x -> x |> Degree.toArcMinutes |> ArcMinute.toDegrees) + "To arcseconds and back", (fun x -> x |> Degree.toArcSeconds |> ArcSecond.toDegrees) + ] + |> List.map (fun (x, y) -> x, (fun z -> Degree.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let radianConversionTests = + [ + "To degrees and back", (fun x -> x |> Radian.toDegrees |> Degree.toRadians) + "To gradians and back", (fun x -> x |> Radian.toGradians |> Gradian.toRadians) + "To revolutions and back", (fun x -> x |> Radian.toRevolutions |> Revolution.toRadians) + "To arcminutes and back", (fun x -> x |> Radian.toArcMinutes |> ArcMinute.toRadians) + "To arcseconds and back", (fun x -> x |> Radian.toArcSeconds |> ArcSecond.toRadians) + ] + |> List.map (fun (x, y) -> x, (fun z -> Radian.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gradianConversionTests = + [ + "To degrees and back", (fun x -> x |> Gradian.toDegrees |> Degree.toGradians) + "To radians and back", (fun x -> x |> Gradian.toRadians |> Radian.toGradians) + "To revolutions and back", (fun x -> x |> Gradian.toRevolutions |> Revolution.toGradians) + "To arcminutes and back", (fun x -> x |> Gradian.toArcMinutes |> ArcMinute.toGradians) + "To arcseconds and back", (fun x -> x |> Gradian.toArcSeconds |> ArcSecond.toGradians) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gradian.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let revolutionConversionTests = + [ + "To degrees and back", (fun x -> x |> Revolution.toDegrees |> Degree.toRevolutions) + "To radians and back", (fun x -> x |> Revolution.toRadians |> Radian.toRevolutions) + "To gradians and back", (fun x -> x |> Revolution.toGradians |> Gradian.toRevolutions) + "To arcminutes and back", (fun x -> x |> Revolution.toArcMinutes |> ArcMinute.toRevolutions) + "To arcseconds and back", (fun x -> x |> Revolution.toArcSeconds |> ArcSecond.toRevolutions) + ] + |> List.map (fun (x, y) -> x, (fun z -> Revolution.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let arcMinuteConversionTests = + [ + "To degrees and back", (fun x -> x |> ArcMinute.toDegrees |> Degree.toArcMinutes) + "To radians and back", (fun x -> x |> ArcMinute.toRadians |> Radian.toArcMinutes) + "To gradians and back", (fun x -> x |> ArcMinute.toGradians |> Gradian.toArcMinutes) + "To revolutions and back", (fun x -> x |> ArcMinute.toRevolutions |> Revolution.toArcMinutes) + "To arcseconds and back", (fun x -> x |> ArcMinute.toArcSeconds |> ArcSecond.toArcMinutes) + ] + |> List.map (fun (x, y) -> x, (fun z -> ArcMinute.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let arcSecondConversionTests = + [ + "To degrees and back", (fun x -> x |> ArcSecond.toDegrees |> Degree.toArcSeconds) + "To radians and back", (fun x -> x |> ArcSecond.toRadians |> Radian.toArcSeconds) + "To gradians and back", (fun x -> x |> ArcSecond.toGradians |> Gradian.toArcSeconds) + "To revolutions and back", (fun x -> x |> ArcSecond.toRevolutions |> Revolution.toArcSeconds) + "To arcminutes and back", (fun x -> x |> ArcSecond.toArcMinutes |> ArcMinute.toArcSeconds) + ] + |> List.map (fun (x, y) -> x, (fun z -> ArcSecond.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Angle Tests" + [ + testList "Degree conversions" degreeConversionTests + testList "Radian conversions" radianConversionTests + testList "Gradian conversions" gradianConversionTests + testList "Revolution conversions" revolutionConversionTests + testList "ArcMinute conversions" arcMinuteConversionTests + testList "ArcSecond conversions" arcSecondConversionTests + ] + +let dataStorageTests config = + + let bitConversionTests = + [ + "To kilobit and back", (fun x -> x |> Bit.toKilobits |> Kilobit.toBits) + "To megabit and back", (fun x -> x |> Bit.toMegabits |> Megabit.toBits) + "To gigabit and back", (fun x -> x |> Bit.toGigabits |> Gigabit.toBits) + "To terabit and back", (fun x -> x |> Bit.toTerabits |> Terabit.toBits) + "To petabit and back", (fun x -> x |> Bit.toPetabits |> Petabit.toBits) + "To byte and back", (fun x -> x |> Bit.toBytes |> Byte.toBits) + "To kilobyte and back", (fun x -> x |> Bit.toKilobytes |> Kilobyte.toBits) + "To megabyte and back", (fun x -> x |> Bit.toMegabytes |> Megabyte.toBits) + "To gigabyte and back", (fun x -> x |> Bit.toGigabytes |> Gigabyte.toBits) + "To terabyte and back", (fun x -> x |> Bit.toTerabytes |> Terabyte.toBits) + "To petabyte and back", (fun x -> x |> Bit.toPetabytes |> Petabyte.toBits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Bit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilobitConversionTests = + [ + "To bit and back", (fun x -> x |> Kilobit.toBits |> Bit.toKilobits) + "To megabit and back", (fun x -> x |> Kilobit.toMegabits |> Megabit.toKilobits) + "To gigabit and back", (fun x -> x |> Kilobit.toGigabits |> Gigabit.toKilobits) + "To terabit and back", (fun x -> x |> Kilobit.toTerabits |> Terabit.toKilobits) + "To petabit and back", (fun x -> x |> Kilobit.toPetabits |> Petabit.toKilobits) + "To byte and back", (fun x -> x |> Kilobit.toBytes |> Byte.toKilobits) + "To kilobyte and back", (fun x -> x |> Kilobit.toKilobytes |> Kilobyte.toKilobits) + "To megabyte and back", (fun x -> x |> Kilobit.toMegabytes |> Megabyte.toKilobits) + "To gigabyte and back", (fun x -> x |> Kilobit.toGigabytes |> Gigabyte.toKilobits) + "To terabyte and back", (fun x -> x |> Kilobit.toTerabytes |> Terabyte.toKilobits) + "To petabyte and back", (fun x -> x |> Kilobit.toPetabytes |> Petabyte.toKilobits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilobit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megabitConversionTests = + [ + "To bit and back", (fun x -> x |> Megabit.toBits |> Bit.toMegabits) + "To kilobit and back", (fun x -> x |> Megabit.toKilobits |> Kilobit.toMegabits) + "To gigabit and back", (fun x -> x |> Megabit.toGigabits |> Gigabit.toMegabits) + "To terabit and back", (fun x -> x |> Megabit.toTerabits |> Terabit.toMegabits) + "To petabit and back", (fun x -> x |> Megabit.toPetabits |> Petabit.toMegabits) + "To byte and back", (fun x -> x |> Megabit.toBytes |> Byte.toMegabits) + "To kilobyte and back", (fun x -> x |> Megabit.toKilobytes |> Kilobyte.toMegabits) + "To megabyte and back", (fun x -> x |> Megabit.toMegabytes |> Megabyte.toMegabits) + "To gigabyte and back", (fun x -> x |> Megabit.toGigabytes |> Gigabyte.toMegabits) + "To terabyte and back", (fun x -> x |> Megabit.toTerabytes |> Terabyte.toMegabits) + "To petabyte and back", (fun x -> x |> Megabit.toPetabytes |> Petabyte.toMegabits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Megabit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gigabitConversionTests = + [ + "To bit and back", (fun x -> x |> Gigabit.toBits |> Bit.toGigabits) + "To kilobit and back", (fun x -> x |> Gigabit.toKilobits |> Kilobit.toGigabits) + "To megabit and back", (fun x -> x |> Gigabit.toMegabits |> Megabit.toGigabits) + "To terabit and back", (fun x -> x |> Gigabit.toTerabits |> Terabit.toGigabits) + "To petabit and back", (fun x -> x |> Gigabit.toPetabits |> Petabit.toGigabits) + "To byte and back", (fun x -> x |> Gigabit.toBytes |> Byte.toGigabits) + "To kilobyte and back", (fun x -> x |> Gigabit.toKilobytes |> Kilobyte.toGigabits) + "To megabyte and back", (fun x -> x |> Gigabit.toMegabytes |> Megabyte.toGigabits) + "To gigabyte and back", (fun x -> x |> Gigabit.toGigabytes |> Gigabyte.toGigabits) + "To terabyte and back", (fun x -> x |> Gigabit.toTerabytes |> Terabyte.toGigabits) + "To petabyte and back", (fun x -> x |> Gigabit.toPetabytes |> Petabyte.toGigabits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gigabit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let terabitConversionTests = + [ + "To bit and back", (fun x -> x |> Terabit.toBits |> Bit.toTerabits) + "To kilobit and back", (fun x -> x |> Terabit.toKilobits |> Kilobit.toTerabits) + "To megabit and back", (fun x -> x |> Terabit.toMegabits |> Megabit.toTerabits) + "To gigabit and back", (fun x -> x |> Terabit.toGigabits |> Gigabit.toTerabits) + "To petabit and back", (fun x -> x |> Terabit.toPetabits |> Petabit.toTerabits) + "To byte and back", (fun x -> x |> Terabit.toBytes |> Byte.toTerabits) + "To kilobyte and back", (fun x -> x |> Terabit.toKilobytes |> Kilobyte.toTerabits) + "To megabyte and back", (fun x -> x |> Terabit.toMegabytes |> Megabyte.toTerabits) + "To gigabyte and back", (fun x -> x |> Terabit.toGigabytes |> Gigabyte.toTerabits) + "To terabyte and back", (fun x -> x |> Terabit.toTerabytes |> Terabyte.toTerabits) + "To petabyte and back", (fun x -> x |> Terabit.toPetabytes |> Petabyte.toTerabits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Terabit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let petabitConversionTests = + [ + "To bit and back", (fun x -> x |> Petabit.toBits |> Bit.toPetabits) + "To kilobit and back", (fun x -> x |> Petabit.toKilobits |> Kilobit.toPetabits) + "To megabit and back", (fun x -> x |> Petabit.toMegabits |> Megabit.toPetabits) + "To gigabit and back", (fun x -> x |> Petabit.toGigabits |> Gigabit.toPetabits) + "To terabit and back", (fun x -> x |> Petabit.toTerabits |> Terabit.toPetabits) + "To byte and back", (fun x -> x |> Petabit.toBytes |> Byte.toPetabits) + "To kilobyte and back", (fun x -> x |> Petabit.toKilobytes |> Kilobyte.toPetabits) + "To megabyte and back", (fun x -> x |> Petabit.toMegabytes |> Megabyte.toPetabits) + "To gigabyte and back", (fun x -> x |> Petabit.toGigabytes |> Gigabyte.toPetabits) + "To terabyte and back", (fun x -> x |> Petabit.toTerabytes |> Terabyte.toPetabits) + "To petabyte and back", (fun x -> x |> Petabit.toPetabytes |> Petabyte.toPetabits) + ] + |> List.map (fun (x, y) -> x, (fun z -> Petabit.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let byteConversionTests = + [ + "To bit and back", (fun x -> x |> Byte.toBits |> Bit.toBytes) + "To kilobit and back", (fun x -> x |> Byte.toKilobits |> Kilobit.toBytes) + "To megabit and back", (fun x -> x |> Byte.toMegabits |> Megabit.toBytes) + "To gigabit and back", (fun x -> x |> Byte.toGigabits |> Gigabit.toBytes) + "To terabit and back", (fun x -> x |> Byte.toTerabits |> Terabit.toBytes) + "To petabit and back", (fun x -> x |> Byte.toPetabits |> Petabit.toBytes) + "To kilobyte and back", (fun x -> x |> Byte.toKilobytes |> Kilobyte.toBytes) + "To megabyte and back", (fun x -> x |> Byte.toMegabytes |> Megabyte.toBytes) + "To gigabyte and back", (fun x -> x |> Byte.toGigabytes |> Gigabyte.toBytes) + "To terabyte and back", (fun x -> x |> Byte.toTerabytes |> Terabyte.toBytes) + "To petabyte and back", (fun x -> x |> Byte.toPetabytes |> Petabyte.toBytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Byte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilobyteConversionTests = + [ + "To bit and back", (fun x -> x |> Kilobyte.toBits |> Bit.toKilobytes) + "To kilobit and back", (fun x -> x |> Kilobyte.toKilobits |> Kilobit.toKilobytes) + "To megabit and back", (fun x -> x |> Kilobyte.toMegabits |> Megabit.toKilobytes) + "To gigabit and back", (fun x -> x |> Kilobyte.toGigabits |> Gigabit.toKilobytes) + "To terabit and back", (fun x -> x |> Kilobyte.toTerabits |> Terabit.toKilobytes) + "To petabit and back", (fun x -> x |> Kilobyte.toPetabits |> Petabit.toKilobytes) + "To byte and back", (fun x -> x |> Kilobyte.toBytes |> Byte.toKilobytes) + "To megabyte and back", (fun x -> x |> Kilobyte.toMegabytes |> Megabyte.toKilobytes) + "To gigabyte and back", (fun x -> x |> Kilobyte.toGigabytes |> Gigabyte.toKilobytes) + "To terabyte and back", (fun x -> x |> Kilobyte.toTerabytes |> Terabyte.toKilobytes) + "To petabyte and back", (fun x -> x |> Kilobyte.toPetabytes |> Petabyte.toKilobytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilobyte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megabyteConversionTests = + [ + "To bit and back", (fun x -> x |> Megabyte.toBits |> Bit.toMegabytes) + "To kilobit and back", (fun x -> x |> Megabyte.toKilobits |> Kilobit.toMegabytes) + "To megabit and back", (fun x -> x |> Megabyte.toMegabits |> Megabit.toMegabytes) + "To gigabit and back", (fun x -> x |> Megabyte.toGigabits |> Gigabit.toMegabytes) + "To terabit and back", (fun x -> x |> Megabyte.toTerabits |> Terabit.toMegabytes) + "To petabit and back", (fun x -> x |> Megabyte.toPetabits |> Petabit.toMegabytes) + "To byte and back", (fun x -> x |> Megabyte.toBytes |> Byte.toMegabytes) + "To kilobyte and back", (fun x -> x |> Megabyte.toKilobytes |> Kilobyte.toMegabytes) + "To gigabyte and back", (fun x -> x |> Megabyte.toGigabytes |> Gigabyte.toMegabytes) + "To terabyte and back", (fun x -> x |> Megabyte.toTerabytes |> Terabyte.toMegabytes) + "To petabyte and back", (fun x -> x |> Megabyte.toPetabytes |> Petabyte.toMegabytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Megabyte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gigabyteConversionTests = + [ + "To bit and back", (fun x -> x |> Gigabyte.toBits |> Bit.toGigabytes) + "To kilobit and back", (fun x -> x |> Gigabyte.toKilobits |> Kilobit.toGigabytes) + "To megabit and back", (fun x -> x |> Gigabyte.toMegabits |> Megabit.toGigabytes) + "To gigabit and back", (fun x -> x |> Gigabyte.toGigabits |> Gigabit.toGigabytes) + "To terabit and back", (fun x -> x |> Gigabyte.toTerabits |> Terabit.toGigabytes) + "To petabit and back", (fun x -> x |> Gigabyte.toPetabits |> Petabit.toGigabytes) + "To byte and back", (fun x -> x |> Gigabyte.toBytes |> Byte.toGigabytes) + "To kilobyte and back", (fun x -> x |> Gigabyte.toKilobytes |> Kilobyte.toGigabytes) + "To megabyte and back", (fun x -> x |> Gigabyte.toMegabytes |> Megabyte.toGigabytes) + "To terabyte and back", (fun x -> x |> Gigabyte.toTerabytes |> Terabyte.toGigabytes) + "To petabyte and back", (fun x -> x |> Gigabyte.toPetabytes |> Petabyte.toGigabytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gigabyte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let terabyteConversionTests = + [ + "To bit and back", (fun x -> x |> Terabyte.toBits |> Bit.toTerabytes) + "To kilobit and back", (fun x -> x |> Terabyte.toKilobits |> Kilobit.toTerabytes) + "To megabit and back", (fun x -> x |> Terabyte.toMegabits |> Megabit.toTerabytes) + "To gigabit and back", (fun x -> x |> Terabyte.toGigabits |> Gigabit.toTerabytes) + "To terabit and back", (fun x -> x |> Terabyte.toTerabits |> Terabit.toTerabytes) + "To petabit and back", (fun x -> x |> Terabyte.toPetabits |> Petabit.toTerabytes) + "To byte and back", (fun x -> x |> Terabyte.toBytes |> Byte.toTerabytes) + "To kilobyte and back", (fun x -> x |> Terabyte.toKilobytes |> Kilobyte.toTerabytes) + "To megabyte and back", (fun x -> x |> Terabyte.toMegabytes |> Megabyte.toTerabytes) + "To gigabyte and back", (fun x -> x |> Terabyte.toGigabytes |> Gigabyte.toTerabytes) + "To petabyte and back", (fun x -> x |> Terabyte.toPetabytes |> Petabyte.toTerabytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Terabyte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let petabyteConversionTests = + [ + "To bit and back", (fun x -> x |> Petabyte.toBits |> Bit.toPetabytes) + "To kilobit and back", (fun x -> x |> Petabyte.toKilobits |> Kilobit.toPetabytes) + "To megabit and back", (fun x -> x |> Petabyte.toMegabits |> Megabit.toPetabytes) + "To gigabit and back", (fun x -> x |> Petabyte.toGigabits |> Gigabit.toPetabytes) + "To terabit and back", (fun x -> x |> Petabyte.toTerabits |> Terabit.toPetabytes) + "To petabit and back", (fun x -> x |> Petabyte.toPetabits |> Petabit.toPetabytes) + "To byte and back", (fun x -> x |> Petabyte.toBytes |> Byte.toPetabytes) + "To kilobyte and back", (fun x -> x |> Petabyte.toKilobytes |> Kilobyte.toPetabytes) + "To megabyte and back", (fun x -> x |> Petabyte.toMegabytes |> Megabyte.toPetabytes) + "To gigabyte and back", (fun x -> x |> Petabyte.toGigabytes |> Gigabyte.toPetabytes) + "To terabyte and back", (fun x -> x |> Petabyte.toTerabytes |> Terabyte.toPetabytes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Petabyte.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Data storage tests" + [ + testList "Bit conversions" bitConversionTests + testList "Kilobit conversions" kilobitConversionTests + testList "Megabit conversions" megabitConversionTests + testList "Gigabit conversions" gigabitConversionTests + testList "Terabit conversions" terabitConversionTests + testList "Petabit conversions" petabitConversionTests + testList "Byte conversions" byteConversionTests + testList "Kilobyte conversions" kilobyteConversionTests + testList "Megabyte conversions" megabyteConversionTests + testList "Gigabyte conversions" gigabyteConversionTests + testList "Terabyte conversions" terabyteConversionTests + testList "Petabyte conversions" petabyteConversionTests + ] + +let fuelEconomyTests config = + + let kilometerPerLiterConversionTests = + [ + "From km/l to mpg", (fun x -> x |> KilometerPerLiter.toMilesPerGallon |> MilePerGallon.toKilometersPerLiter) + ] + |> List.map (fun (x, y) -> x, (fun z -> KilometerPerLiter.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let milePerGallonConversionTests = + [ + "To km/l", (fun x -> x |> MilePerGallon.toKilometersPerLiter |> KilometerPerLiter.toMilesPerGallon) + ] + |> List.map (fun (x, y) -> x, (fun z -> MilePerGallon.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Fuel economy tests" + [ + testList "Kilometer per liter conversions" kilometerPerLiterConversionTests + testList "Mile per gallon conversions" milePerGallonConversionTests + ] + +let frequencyTests config = + + let hertzConversionTest = + [ + "To kilohertz and back", (fun x -> x |> Hertz.toKilohertz |> Kilohertz.toHertz) + "To megahertz and back", (fun x -> x |> Hertz.toMegahertz |> Megahertz.toHertz) + "To gigahertz and back", (fun x -> x |> Hertz.toGigahertz |> Gigahertz.toHertz) + ] + |> List.map (fun (x, y) -> x, (fun z -> Hertz.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let kilohertzConversionTest = + [ + "To hertz and back", (fun x -> x |> Kilohertz.toHertz |> Hertz.toKilohertz) + "To megahertz and back", (fun x -> x |> Kilohertz.toMegahertz |> Megahertz.toKilohertz) + "To gigahertz and back", (fun x -> x |> Kilohertz.toGigahertz |> Gigahertz.toKilohertz) + ] + |> List.map (fun (x, y) -> x, (fun z -> Kilohertz.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let megahertzConversionTest = + [ + "To hertz and back", (fun x -> x |> Megahertz.toHertz |> Hertz.toMegahertz) + "To kilohertz and back", (fun x -> x |> Megahertz.toKilohertz |> Kilohertz.toMegahertz) + "To gigahertz and back", (fun x -> x |> Megahertz.toGigahertz |> Gigahertz.toMegahertz) + ] + |> List.map (fun (x, y) -> x, (fun z -> Megahertz.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let gigahertzConversionTest = + [ + "To hertz and back", (fun x -> x |> Gigahertz.toHertz |> Hertz.toGigahertz) + "To kilohertz and back", (fun x -> x |> Gigahertz.toKilohertz |> Kilohertz.toGigahertz) + "To megahertz and back", (fun x -> x |> Gigahertz.toMegahertz |> Megahertz.toGigahertz) + ] + |> List.map (fun (x, y) -> x, (fun z -> Gigahertz.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Frequency tests" + [ + testList "Hertz conversions" hertzConversionTest + testList "Kilohertz conversions" kilohertzConversionTest + testList "Megahertz conversions" megahertzConversionTest + testList "Gigahertz conversions" gigahertzConversionTest + ] + +let illuminanceTests config = + + let footcandleConversionTests = + [ + "To lux and back", (fun x -> x |> Footcandle.toLux |> Lux.toFootcandle) + "To phot and back", (fun x -> x |> Footcandle.toPhot |> Phot.toFootcandle) + "To nox and back", (fun x -> x |> Footcandle.toNox |> Nox.toFootcandle) + ] + |> List.map (fun (x, y) -> x, (fun z -> Footcandle.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let luxConversionTests = + [ + "To footcandle and back", (fun x -> x |> Lux.toFootcandle |> Footcandle.toLux) + "To phot and back", (fun x -> x |> Lux.toPhot |> Phot.toLux) + "To nox and back", (fun x -> x |> Lux.toNox |> Nox.toLux) + ] + |> List.map (fun (x, y) -> x, (fun z -> Lux.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let photConversionTests = + [ + "To footcandle and back", (fun x -> x |> Phot.toFootcandle |> Footcandle.toPhot) + "To lux and back", (fun x -> x |> Phot.toLux |> Lux.toPhot) + "To nox and back", (fun x -> x |> Phot.toNox |> Nox.toPhot) + ] + |> List.map (fun (x, y) -> x, (fun z -> Phot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let noxConversionTests = + [ + "To footcandle and back", (fun x -> x |> Nox.toFootcandle |> Footcandle.toNox) + "To lux and back", (fun x -> x |> Nox.toLux |> Lux.toNox) + "To phot and back", (fun x -> x |> Nox.toPhot |> Phot.toNox) + ] + |> List.map (fun (x, y) -> x, (fun z -> Nox.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Illuminance tests" + [ + testList "Footcandle conversions" footcandleConversionTests + testList "Lux conversions" luxConversionTests + testList "Phot conversions" photConversionTests + testList "Nox conversions" noxConversionTests + ] + +let currentTests config = + + let ampereConversionTests = + [ + "To milliampere and back", (fun x -> x |> Ampere.toMilliamperes |> Milliampere.toAmperes) + "To microampere and back", (fun x -> x |> Ampere.toMicroamperes |> Microampere.toAmperes) + "To biot and back", (fun x -> x |> Ampere.toBiots |> Biot.toAmperes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Ampere.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let milliampereConversionTests = + [ + "To ampere and back", (fun x -> x |> Milliampere.toAmperes |> Ampere.toMilliamperes) + "To microampere and back", (fun x -> x |> Milliampere.toMicroamperes |> Microampere.toMilliamperes) + "To biot and back", (fun x -> x |> Milliampere.toBiots |> Biot.toMilliamperes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Milliampere.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let microampereConversionTests = + [ + "To ampere and back", (fun x -> x |> Microampere.toAmperes |> Ampere.toMicroamperes) + "To milliampere and back", (fun x -> x |> Microampere.toMilliamperes |> Milliampere.toMicroamperes) + "To biot and back", (fun x -> x |> Microampere.toBiots |> Biot.toMicroamperes) + ] + |> List.map (fun (x, y) -> x, (fun z -> Microampere.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + let biotConversionTests = + [ + "To ampere and back", (fun x -> x |> Biot.toAmperes |> Ampere.toBiots) + "To milliampere and back", (fun x -> x |> Biot.toMilliamperes |> Milliampere.toBiots) + "To microampere and back", (fun x -> x |> Biot.toMicroamperes |> Microampere.toBiots) + ] + |> List.map (fun (x, y) -> x, (fun z -> Biot.create z |> y)) + |> List.map (fun (x, y) -> testConversionRoundingError config Accuracy.high x y) + + testList + "Current tests" + [ + testList "Ampere conversions" ampereConversionTests + testList "Milliampere conversions" milliampereConversionTests + testList "Microampere conversions" microampereConversionTests + testList "Biot conversions" biotConversionTests + ] diff --git a/tests/Fs.Units.Tests.Unit/paket.references b/tests/Fs.Units.Tests.Unit/paket.references new file mode 100644 index 0000000..2f53514 --- /dev/null +++ b/tests/Fs.Units.Tests.Unit/paket.references @@ -0,0 +1,3 @@ +Expecto.FsCheck +YoloDev.Expecto.TestSdk +Microsoft.NET.Test.Sdk \ No newline at end of file