Skip to content

Commit

Permalink
Test for mur128
Browse files Browse the repository at this point in the history
  • Loading branch information
eigokor committed Jan 20, 2018
1 parent 6a6c5ca commit f8ad378
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions test/plugin/test_out_genuniqueid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_configure
def test_md5(data)
d = create_driver(%[
keys id, time, v, k
hash_type md5 # md5 or sha1 or sha256 or sha512
hash_type md5 # md5 or sha1 or sha256 or sha512 or mur128
base64_enc "#{data["base64_enc"]}"
base91_enc "#{data["base91_enc"]}"
set_key _id
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_md5(data)
def test_sha1(data)
d = create_driver(%[
keys id, time, v, k
hash_type sha1 # md5 or sha1 or sha256 or sha512
hash_type sha1 # md5 or sha1 or sha256 or sha512 or mur128
base64_enc "#{data["base64_enc"]}"
base91_enc "#{data["base91_enc"]}"
set_key _id
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_sha1(data)
def test_sha256(data)
d = create_driver(%[
keys id, time, v, k
hash_type sha256 # md5 or sha1 or sha256 or sha512
hash_type sha256 # md5 or sha1 or sha256 or sha512 or mur128
base64_enc "#{data["base64_enc"]}"
base91_enc "#{data["base91_enc"]}"
set_key _id
Expand Down Expand Up @@ -155,7 +155,41 @@ def test_sha256(data)
def test_sha512(data)
d = create_driver(%[
keys id, time, v, k
hash_type sha512 # md5 or sha1 or sha256 or sha512
hash_type sha512 # md5 or sha1 or sha256 or sha512 or mur128
base64_enc "#{data["base64_enc"]}"
base91_enc "#{data["base91_enc"]}"
set_key _id
separator ,
inc_time_as_key false
inc_tag_as_key false
])
time = event_time("2016-10-23 13:14:15 UTC")
time2 = event_time

d.run(default_tag: 'test') do
d.feed(time, {"id"=>1, "time"=>time, "time2"=>time2, "v"=>"日本語", "k"=>"値"})
end

# ### FileOutput#write returns path
filtered = d.filtered
assert_equal 1, filtered[0][1]['id']
assert_equal data["expected"], filtered[0][1]['_id']
end

data("base" => {"base64_enc" => false,
"base91_enc" => false,
"expected" =>"c283c0806dc63da6f66eda61a044537c"},
"base64_enc" => {"base64_enc" => true,
"base91_enc" => false,
"expected" => "woPAgG3GPab2btphoERTfA=="},
"base91_enc" => {"base64_enc" => false,
"base91_enc" => true,
"expected" => "1KU!R=v=s`F&[U3?S2_K"}
)
def test_mur128(data)
d = create_driver(%[
keys id, time, v, k
hash_type mur128 # md5 or sha1 or sha256 or sha512 or mur128
base64_enc "#{data["base64_enc"]}"
base91_enc "#{data["base91_enc"]}"
set_key _id
Expand All @@ -176,3 +210,4 @@ def test_sha512(data)
assert_equal data["expected"], filtered[0][1]['_id']
end
end

0 comments on commit f8ad378

Please sign in to comment.