ctapi 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/make_doc.rb ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $outdir = 'doc/'
4
+ puts "Creating documentation in '#$outdir'."
5
+ system "rdoc -o #$outdir lib/ctapi.rb ext/ctapicore.c"
6
+ # vim: set et sw=2 ts=2:
data/tests/test.rb ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'ctapi'
5
+
6
+ class TC_CTAPI < Test::Unit::TestCase
7
+
8
+ include CTAPI
9
+ @@ct = Cardterminal.init(PORT_COM1)
10
+
11
+ def test_preconditions
12
+ assert_instance_of(Cardterminal, @@ct)
13
+ assert_instance_of(Cardterminal::Manufacturer, @@ct.manufacturer)
14
+ assert(@@ct.card_inserted?)
15
+ assert_instance_of(Cardterminal::Card, @@ct.card)
16
+ assert(@@ct.card.atr_ok?)
17
+ assert(@@ct.card.memory_size >= 255) # I hope there is no smaller size
18
+ assert(@@ct.card.structure)
19
+ assert(@@ct.card.protocol)
20
+ end
21
+
22
+ def test_read
23
+ assert(!@@ct.read(0, 0))
24
+ assert(@@ct.read(0, 255).size == 255)
25
+ assert(@@ct.read.size == @@ct.card.memory_size)
26
+ assert(@@ct.read(100).size == @@ct.card.memory_size - 100)
27
+ old_cs = @@ct.chunk_size
28
+ @@ct.chunk_size = 23
29
+ assert(!@@ct.read(0, 0))
30
+ assert(@@ct.read(0, 255).size == 255)
31
+ assert(@@ct.read.size == @@ct.card.memory_size)
32
+ assert(@@ct.read(100).size == @@ct.card.memory_size - 100)
33
+ @@ct.chunk_size = old_cs
34
+ end
35
+
36
+ def test_write
37
+ data = (1..255).to_a
38
+ big = "A" * @@ct.card.memory_size
39
+ assert(!@@ct.write(''))
40
+ assert(@@ct.write(data))
41
+ assert_equal(data.pack("C*"), @@ct.read(0, 255))
42
+ assert(@@ct.write(big))
43
+ assert_equal(@@ct.read, big)
44
+ old_cs = @@ct.chunk_size
45
+ @@ct.chunk_size = 23
46
+ assert(!@@ct.write(''))
47
+ assert(@@ct.write(data))
48
+ assert_equal(data.pack("C*"), @@ct.read(0, 255))
49
+ assert(@@ct.write(big))
50
+ assert_equal(@@ct.read, big)
51
+ @@ct.chunk_size = old_cs
52
+ end
53
+
54
+ end
55
+ # vim: set et sw=2 ts=2:
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.1
3
+ specification_version: 1
4
+ name: ctapi
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.2.2
7
+ date: 2004-10-01
8
+ summary: Ruby extension for Chipcard Cardterminal-API (CTAPI)
9
+ require_paths:
10
+ - lib
11
+ author: Florian Frank
12
+ email: flori@ping.de
13
+ homepage: http://ctapi.rubyforge.org
14
+ rubyforge_project: ctapi
15
+ description: "These are Ruby bindings to a library that supports the Cardterminal-API (CTAPI) for chipcards. It should be possible to link this against any carddriver library that supports this standard, but I have actually only tested with libtowitoko."
16
+ autorequire: ctapi
17
+ default_executable:
18
+ bindir: bin
19
+ has_rdoc: true
20
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ requirements:
22
+ -
23
+ - ">"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.0.0
26
+ version:
27
+ platform: ruby
28
+ files:
29
+ - README.en
30
+ - CHANGES
31
+ - GPL
32
+ - examples
33
+ - Rakefile
34
+ - VERSION
35
+ - install.rb
36
+ - make_doc.rb
37
+ - ext
38
+ - lib
39
+ - tests
40
+ - examples/cardinfo.rb
41
+ - examples/ctsh.rb
42
+ - ext/ctapicore.c
43
+ - ext/extconf.rb
44
+ - lib/ctapi.rb
45
+ - tests/test.rb
46
+ test_files: []
47
+ rdoc_options: []
48
+ extra_rdoc_files: []
49
+ executables: []
50
+ extensions:
51
+ - ext/extconf.rb
52
+ requirements: []
53
+ dependencies: []