From 0217e6736c5498408c741d23fa3541f0d5a7525a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 11 Jun 2019 20:42:45 +0500 Subject: [PATCH] Add test cases --- test/test_all.rb | 1 + test/test_new.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/test_new.rb diff --git a/test/test_all.rb b/test/test_all.rb index 4e987e8..12b66f5 100644 --- a/test/test_all.rb +++ b/test/test_all.rb @@ -5,3 +5,4 @@ $LOAD_PATH.unshift(File.expand_path("ext")) require 'digest/keccak' require File.expand_path('test/test_usage') require File.expand_path('test/test_vectors') +require File.expand_path('test/test_new') diff --git a/test/test_new.rb b/test/test_new.rb new file mode 100644 index 0000000..c618fde --- /dev/null +++ b/test/test_new.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'test/unit' + +class KeccakNewTests < Test::Unit::TestCase + def test_singleton_method_hexdigest_256_empty + result = Digest::Keccak.hexdigest '', 256 + assert_instance_of String, result + assert_equal 'c5d2460186f7233c927e7db2dcc703c0' \ + 'e500b653ca82273b7bfad8045d85a470', + result + end + + def test_singleton_method_hexdigest_256_sample + result = Digest::Keccak.hexdigest 'sample', 256 + assert_instance_of String, result + assert_equal 'b80204f7e9243e4fca5489740ccd31dc' \ + 'd0a54619a7f4165cee73c191ef7271a1', + result + end +end