Skip to content

Commit

Permalink
Add a Bitfield test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesduncombe committed Nov 11, 2020
1 parent e3ddab6 commit e61eb13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/petal/bitfield_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule Petal.BitfieldTest do
use ExUnit.Case

alias Petal.Bitfield

describe "new/1" do
test "returns a new bitfield of size `x`" do
bitfield = Bitfield.new(64)
assert bitfield.size == 64
assert bitfield.bitfield == <<0, 0, 0, 0, 0, 0, 0, 0>>
end
end

test "to_string/1" do
bitfield = Bitfield.new(8)
assert to_string(bitfield) =~ ~r/Field data: 00000000/
end
end
1 change: 1 addition & 0 deletions test/petal/bytes_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Petal.BytesTest do
use ExUnit.Case
doctest Petal.Bytes

alias Petal.Bytes

Expand Down

0 comments on commit e61eb13

Please sign in to comment.