-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxim Chechel
committed
Oct 8, 2014
1 parent
7edc3ad
commit 6532e8b
Showing
11 changed files
with
118 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'test_helper' | ||
require 'ruby-nfc/apdu/response' | ||
|
||
class APDUResponseTest < MiniTest::Unit::TestCase | ||
def setup | ||
@response = APDU::Response.new("\x01\x02\x03\x04\x69\x85") | ||
end | ||
|
||
def test_raise_apdu_error_if_length_too_small | ||
assert_raises(APDU::Error) { APDU::Response.new("") } | ||
end | ||
|
||
def test_data | ||
assert_equal "\x01\x02\x03\x04", @response.data | ||
end | ||
|
||
def test_sw | ||
assert_equal 0x6985, @response.sw | ||
end | ||
|
||
def test_sw1 | ||
assert_equal 0x69, @response.sw1 | ||
end | ||
|
||
def test_sw2 | ||
assert_equal 0x85, @response.sw2 | ||
end | ||
|
||
def test_raise_errno | ||
e = assert_raises(APDU::Errno) { @response.raise_errno! } | ||
assert_equal 0x6985, e.code | ||
end | ||
|
||
end |