Pentole/tests/bytes_tests.fs
2024-09-28 11:37:55 +02:00

31 lines
888 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 |> 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