Pentole/tests/bytes_tests.fs

31 lines
767 B
Forth
Raw Normal View History

module Tests.BinaryPrefix
open NUnit.Framework
2024-12-12 11:37:59 +01:00
open Pentole.Assert
2024-09-28 11:37:55 +02:00
open Pentole.BinaryPrefix.Bits
open Pentole.BinaryPrefix.Bytes
[<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