Pentole/tests/bytes_tests.fs
2024-12-12 10:37:42 +01:00

30 lines
776 B
Forth

module Tests.BinaryPrefix
open NUnit.Framework
open Pentole.TestsExtensions
open Pentole.BinaryPrefix.Bits
open Pentole.BinaryPrefix.Bytes
[<Test>]
let equality_test () =
1.0.KB |> areEqual (1000.0.bytes)
1.0.KiB.bytes |> areEqual (1024.0.bytes.bytes)
[<Test>]
let ``Bit.bytes returns correct values`` () =
areEqual 0.125 1.0.bits.bytes
areEqual 125.0 1.0.Kb.bytes
areEqual 125000.0 1.0.Mb.bytes
areEqual 125000000.0 1.0.Gb.bytes
areEqual 125000000000.0 1.0.Tb.bytes
areEqual 125000000000000.0 1.0.Pb.bytes
areEqual 0.250 2.0.bits.bytes
areEqual 250.0 2.0.Kb.bytes
areEqual 250000.0 2.0.Mb.bytes
areEqual 500000000.0 4.0.Gb.bytes
areEqual 500000000000.0 4.0.Tb.bytes
areEqual 500000000000000.0 4.0.Pb.bytes