Pentole/tests/bytes_tests.fs

31 lines
888 B
Forth
Raw Permalink Normal View History

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
[<Test>]
2024-09-16 18:18:24 +02:00
let equality_test () =
2024-09-28 11:37:55 +02:00
1.0.KB |> Assert.are_equal (1000.0.bytes)
1.0.KiB.bytes |> Assert.are_equal (1024.0.bytes.bytes)
[<Test>]
let ``Bit.bytes returns correct values`` () =
Assert.are_equal 0.125 1.0.bits.bytes
Assert.are_equal 125.0 1.0.Kb.bytes
Assert.are_equal 125000.0 1.0.Mb.bytes
Assert.are_equal 125000000.0 1.0.Gb.bytes
Assert.are_equal 125000000000.0 1.0.Tb.bytes
Assert.are_equal 125000000000000.0 1.0.Pb.bytes
Assert.are_equal 0.250 2.0.bits.bytes
Assert.are_equal 250.0 2.0.Kb.bytes
Assert.are_equal 250000.0 2.0.Mb.bytes
Assert.are_equal 500000000.0 4.0.Gb.bytes
Assert.are_equal 500000000000.0 4.0.Tb.bytes
Assert.are_equal 500000000000000.0 4.0.Pb.bytes