Skip to content

Commit

Permalink
tests for eslength
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryape committed Aug 2, 2024
1 parent 176cc0d commit dd1dd25
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 15 deletions.
17 changes: 16 additions & 1 deletion test/smee/smee_publish_csv_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule SmeePublishCsvTest do
alias Smee.Publish.Csv, as: ThisModule
alias Smee.Source
alias Smee.Entity
# alias Smee.Metadata
alias Smee.Metadata
# alias Smee.Lint
# alias Smee.XmlMunger

Expand Down Expand Up @@ -96,6 +96,21 @@ defmodule SmeePublishCsvTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 330 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_disco_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ defmodule SmeePublishDiscoTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 310 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_index_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ defmodule SmeePublishIndexTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 73 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_markdown_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ defmodule SmeePublishMarkdownTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 464 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_null_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,19 @@ defmodule SmeePublishNullTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 0 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

end
15 changes: 15 additions & 0 deletions test/smee/smee_publish_progress_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ defmodule SmeePublishProgressTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 2 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
29 changes: 15 additions & 14 deletions test/smee/smee_publish_saml_xml_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ defmodule SmeePublishSamlXmlTest do

end


describe "eslength/2" do

test "returns the size of content in the stream" do

end

test "should be about the same size as a compiled binary output" do

end

end


describe "headers/1" do

test "returns an XML declaration, and the opening <entitiesDescriptor> tag" do
Expand Down Expand Up @@ -113,6 +99,21 @@ defmodule SmeePublishSamlXmlTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 41311 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_string_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ defmodule SmeePublishStringTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 93 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,19 @@ defmodule SmeePublishTest do

end

# describe "eslength/2" do
#
# test "returns the size of content in the stream" do
# assert 330 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
# end
#
# test "should be about the same size as a compiled binary output" do
# actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
# estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
# assert (actual_size - estimated_size) in -3..3
#
# end
#
# end

end
15 changes: 15 additions & 0 deletions test/smee/smee_publish_thiss_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ defmodule SmeePublishThissTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 434 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_udest_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ defmodule SmeePublishUdestTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 1746 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down
15 changes: 15 additions & 0 deletions test/smee/smee_publish_udisco_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ defmodule SmeePublishUdiscoTest do

end

describe "eslength/2" do

test "returns the size of content in the stream" do
assert 147 = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
end

test "should be about the same size as a compiled binary output" do
actual_size = byte_size(ThisModule.aggregate(Metadata.stream_entities(@valid_metadata)))
estimated_size = ThisModule.eslength(Metadata.stream_entities(@valid_metadata))
assert (actual_size - estimated_size) in -3..3

end

end

#
#
# describe "x/2" do
Expand Down

0 comments on commit dd1dd25

Please sign in to comment.