2024-09-16 18:05:24 +02:00
|
|
|
module Tests.BinaryPrefix
|
|
|
|
|
|
|
|
open NUnit.Framework
|
|
|
|
|
|
|
|
open Pentole.TestsExtensions
|
2024-09-28 11:37:55 +02:00
|
|
|
open Pentole.BinaryPrefix.Bits
|
|
|
|
open Pentole.BinaryPrefix.Bytes
|
2024-09-16 18:05:24 +02:00
|
|
|
|
|
|
|
[<Test>]
|
2024-09-16 18:18:24 +02:00
|
|
|
let equality_test () =
|
2024-12-12 10:37:42 +01:00
|
|
|
1.0.KB |> areEqual (1000.0.bytes)
|
|
|
|
1.0.KiB.bytes |> areEqual (1024.0.bytes.bytes)
|
2024-09-28 11:37:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
[<Test>]
|
|
|
|
let ``Bit.bytes returns correct values`` () =
|
2024-12-12 10:37:42 +01:00
|
|
|
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
|
2024-09-28 11:37:55 +02:00
|
|
|
|
2024-12-12 10:37:42 +01:00
|
|
|
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
|
2024-09-28 11:37:55 +02:00
|
|
|
|