fit 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/README.txt +203 -0
  2. data/Rakefile +111 -0
  3. data/bin/FitServer.rb +6 -0
  4. data/bin/fit +10 -0
  5. data/bin/fit.cgi +36 -0
  6. data/doc/examples/AllCombinations.html +55 -0
  7. data/doc/examples/AllFiles.html +60 -0
  8. data/doc/examples/AllPairs/function/cosine.html +57 -0
  9. data/doc/examples/AllPairs/function/sine.html +57 -0
  10. data/doc/examples/AllPairs/magnitude/180+30.html +45 -0
  11. data/doc/examples/AllPairs/magnitude/30.html +33 -0
  12. data/doc/examples/AllPairs/magnitude/360+30.html +45 -0
  13. data/doc/examples/AllPairs/magnitude/90-30.html +45 -0
  14. data/doc/examples/AllPairs/sign/change-sign.html +27 -0
  15. data/doc/examples/AllPairs/sign/multiply.html +31 -0
  16. data/doc/examples/AllPairs/sign/no-change.html +23 -0
  17. data/doc/examples/AllPairs.html +51 -0
  18. data/doc/examples/BinaryChop.html +89 -0
  19. data/doc/examples/CalculatorExample.html +108 -0
  20. data/doc/examples/ColumnIndex.html +43 -0
  21. data/doc/examples/ExampleTests.html +43 -0
  22. data/doc/examples/FitAcceptanceTests.html +53 -0
  23. data/doc/examples/GeoCoordinate.html +87 -0
  24. data/doc/examples/MusicExample.html +143 -0
  25. data/doc/examples/MusicExampleWithErrors.html +128 -0
  26. data/doc/examples/NetworkExample.html +47 -0
  27. data/doc/examples/WebPageExample.html +92 -0
  28. data/doc/examples/arithmetic.html +211 -0
  29. data/doc/examples/files/hp35bk.jpg +0 -0
  30. data/doc/examples/logo.gif +0 -0
  31. data/doc/fitnesse/FitNesse.RubY.AcceptanceTests.FixtureParameters.html +81 -0
  32. data/doc/fitnesse/FitNesse.RubY.AcceptanceTests.GracefulFixtureNames.html +87 -0
  33. data/doc/fitnesse/FitNesse.RubY.AcceptanceTests.GracefulMemberNames.html +73 -0
  34. data/doc/fitnesse/FitNesse.RubY.AcceptanceTests.ImportFixture.html +61 -0
  35. data/doc/fitnesse/FitNesse.RubY.AcceptanceTests.WaysToSpecifyaFixtureNamespace.html +81 -0
  36. data/doc/spec/annotation.html +3833 -0
  37. data/doc/spec/extensions.html +302 -0
  38. data/doc/spec/fixtures.html +5181 -0
  39. data/doc/spec/index.html +947 -0
  40. data/doc/spec/parse.html +3094 -0
  41. data/lib/eg/all_combinations.rb +44 -0
  42. data/lib/eg/all_files.rb +94 -0
  43. data/lib/eg/all_pairs.rb +172 -0
  44. data/lib/eg/arithmetic_column_fixture.rb +35 -0
  45. data/lib/eg/arithmetic_fixture.rb +29 -0
  46. data/lib/eg/binary_chop.rb +100 -0
  47. data/lib/eg/calculator.rb +69 -0
  48. data/lib/eg/column_index.rb +85 -0
  49. data/lib/eg/division.rb +13 -0
  50. data/lib/eg/echo_args_fixture.rb +9 -0
  51. data/lib/eg/example_tests.rb +84 -0
  52. data/lib/eg/music/Music.txt +38 -0
  53. data/lib/eg/music/browser.rb +60 -0
  54. data/lib/eg/music/display.rb +24 -0
  55. data/lib/eg/music/music.rb +67 -0
  56. data/lib/eg/music/music_library.rb +70 -0
  57. data/lib/eg/music/music_player.rb +77 -0
  58. data/lib/eg/music/realtime.rb +39 -0
  59. data/lib/eg/music/simulator.rb +81 -0
  60. data/lib/eg/nested/bob.rb +12 -0
  61. data/lib/eg/nested/bob_the_builder_fixture.rb +11 -0
  62. data/lib/eg/net/simulator.rb +69 -0
  63. data/lib/eg/page.rb +91 -0
  64. data/lib/eg/sqrt.rb +19 -0
  65. data/lib/fat/annotation_fixture.rb +83 -0
  66. data/lib/fat/color.rb +45 -0
  67. data/lib/fat/divide.rb +13 -0
  68. data/lib/fat/document_parse_fixture.rb +67 -0
  69. data/lib/fat/equals.rb +59 -0
  70. data/lib/fat/fixture_name_fixture.rb +67 -0
  71. data/lib/fat/html_to_text_fixture.rb +20 -0
  72. data/lib/fat/money.rb +18 -0
  73. data/lib/fat/output_fixture.rb +32 -0
  74. data/lib/fat/parse_fixture.rb +92 -0
  75. data/lib/fat/reference_fixture.rb +31 -0
  76. data/lib/fat/standard_annotation_fixture.rb +58 -0
  77. data/lib/fat/string_writer.rb +12 -0
  78. data/lib/fat/table.rb +23 -0
  79. data/lib/fat/table_parse_fixture.rb +33 -0
  80. data/lib/fat/text_to_html_fixture.rb +21 -0
  81. data/lib/fit/action_fixture.rb +65 -0
  82. data/lib/fit/column_fixture.rb +104 -0
  83. data/lib/fit/file_runner.rb +80 -0
  84. data/lib/fit/fit_protocol.rb +62 -0
  85. data/lib/fit/fit_server.rb +173 -0
  86. data/lib/fit/fixture.rb +309 -0
  87. data/lib/fit/fixture_loader.rb +75 -0
  88. data/lib/fit/import_fixture.rb +9 -0
  89. data/lib/fit/parse.rb +206 -0
  90. data/lib/fit/primitive_fixture.rb +52 -0
  91. data/lib/fit/row_fixture.rb +188 -0
  92. data/lib/fit/scientific_double.rb +70 -0
  93. data/lib/fit/summary.rb +46 -0
  94. data/lib/fit/timed_action_fixture.rb +35 -0
  95. data/lib/fit/type_adapter.rb +95 -0
  96. data/lib/fit/wiki_runner.rb +15 -0
  97. data/lib/fittask.rb +184 -0
  98. data/test/all_tests.rb +13 -0
  99. data/test/file_runner_test.rb +52 -0
  100. data/test/fit_server_test.rb +214 -0
  101. data/test/fixture_loader_test.rb +71 -0
  102. data/test/fixture_test.rb +41 -0
  103. data/test/fixtures/fail_fixture.rb +9 -0
  104. data/test/fixtures/pass_fixture.rb +9 -0
  105. data/test/framework_test.rb +51 -0
  106. data/test/parse_test.rb +101 -0
  107. data/test/row_fixture_test.rb +44 -0
  108. data/test/scientific_double_test.rb +35 -0
  109. data/test/type_adapter_test.rb +120 -0
  110. metadata +165 -0
@@ -0,0 +1,120 @@
1
+ # Copyright (c) 2002 Cunningham & Cunningham, Inc.
2
+ # Released under the terms of the GNU General Public License version 2 or later.
3
+
4
+ require 'test/unit'
5
+ # Make the test run location independent
6
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
7
+ require 'fit/type_adapter'
8
+ require 'fit/column_fixture' # for a dummy fixture
9
+
10
+ module Fit
11
+
12
+ # A dummy fixture used by tests for TypeAdapter
13
+ class TestFixture < ColumnFixture
14
+ attr_accessor :sample_integer, :sample_float, :sample_string
15
+ attr_accessor :sample_array, :sample_boolean # missing sample_date
16
+ attr_accessor :sample_with_2_digits1
17
+ def might_end_in_qm
18
+ false
19
+ end
20
+ def might_end_in_qm?
21
+ true
22
+ end
23
+ def pi
24
+ 3.14159265
25
+ end
26
+ end
27
+
28
+ class TypeAdapterTest < Test::Unit::TestCase
29
+ def setup
30
+ @f = TestFixture.new
31
+ end
32
+ def test_it_can_figure_out_direction
33
+ adapter = TypeAdapter.for @f, 'sample_integer'
34
+ adapter.set(adapter.parse('123456'))
35
+ assert_equal 123456, @f.sample_integer
36
+
37
+ adapter = TypeAdapter.for @f, 'sample_integer?'
38
+ assert_raises(RuntimeError) { adapter.set(adapter.parse('789')) }
39
+ assert_equal 123456, @f.sample_integer
40
+
41
+ adapter = TypeAdapter.for @f, 'sample_integer()'
42
+ assert_raises(RuntimeError) { adapter.set(adapter.parse('789')) }
43
+ assert_equal 123456, @f.sample_integer
44
+ end
45
+ def test_integer
46
+ adapter = TypeAdapter.for @f, 'sample_integer', false
47
+ adapter.set(adapter.parse('123456'))
48
+ assert_equal 123456, @f.sample_integer
49
+ end
50
+ def test_negative_integer
51
+ adapter = TypeAdapter.for @f, 'sample_integer', false
52
+ assert_equal '-234567', adapter.parse('-234567').to_s
53
+ end
54
+ def test_method
55
+ adapter = TypeAdapter.for @f, 'pi', true
56
+ assert_in_delta 3.14159, adapter.get, 0.00001
57
+ assert_equal 3.14159265, adapter.get
58
+ end
59
+ def test_string
60
+ adapter = TypeAdapter.for @f, 'sample_string', false
61
+ adapter.set(adapter.parse('xyzzy'))
62
+ assert_equal 'xyzzy', @f.sample_string
63
+ end
64
+ def test_double
65
+ adapter = TypeAdapter.for @f, 'sample_float', false
66
+ adapter.set(adapter.parse('6.02e23'))
67
+ assert_in_delta 6.02e23, @f.sample_float, 1e17
68
+ end
69
+ def test_array
70
+ adapter = TypeAdapter.for @f, 'sample_array', false
71
+ adapter.set(adapter.parse('1, 2, 3'))
72
+ assert_equal 1, @f.sample_array[0]
73
+ assert_equal 2, @f.sample_array[1]
74
+ assert_equal 3, @f.sample_array[2]
75
+ assert_equal '123', adapter.to_s(@f.sample_array)
76
+ assert_equal [1,2,3], @f.sample_array
77
+ end
78
+ def test_boolean
79
+ verify_sample_boolean_adapter_setter @f, 'sample_boolean'
80
+ end
81
+ def verify_sample_boolean_adapter_setter(fixture,method)
82
+ adapter = TypeAdapter.for fixture, method, false
83
+ adapter.set(adapter.parse('true'))
84
+ assert fixture.sample_boolean
85
+ adapter.set(adapter.parse('false'))
86
+ assert !fixture.sample_boolean
87
+ end
88
+ def test_digits_in_the_name
89
+ adapter = TypeAdapter.for @f, "sample_with_2_digits1", false
90
+ adapter.set(adapter.parse('true'))
91
+ assert @f.sample_with_2_digits1
92
+ adapter.set(adapter.parse('false'))
93
+ assert !@f.sample_with_2_digits1
94
+ end
95
+ def test_graceful_names_setters
96
+ ['SampleBoolean','Sample Boolean','sample boolean','sample? boolean','sample, boolean','sample, boolean?'].each do |name|
97
+ verify_sample_boolean_adapter_setter @f, name
98
+ end
99
+ end
100
+ def test_graceful_names_getters
101
+ ['sample boolean()','sample_boolean()','Sample Boolean()','SampleBoolean()',
102
+ 'sample boolean?','sample_boolean?','Sample Boolean?','SampleBoolean?','Sample.boolean'].each do |name|
103
+ adapter=TypeAdapter.for @f, name
104
+ [true,false].each { |v| @f.sample_boolean=v; assert_equal(v,adapter.get) }
105
+ end
106
+ end
107
+ def test_getters_ending_with_question_mark
108
+ # when the request ends in ?, prefer a method ending in ?
109
+ adapter = TypeAdapter.for @f, "might_end_in_qm?"
110
+ assert adapter.get
111
+ # when the request doesn't end in ?, require a method not ending with ?
112
+ adapter = TypeAdapter.for @f, "might_end_in_qm"
113
+ assert ! adapter.get
114
+ # when the request ends in ? accept a method not ending in ?, if one ending in ? is not present
115
+ @f.sample_string='no qm'
116
+ adapter = TypeAdapter.for @f, "sample_string?"
117
+ assert_equal 'no qm',adapter.get
118
+ end
119
+ end
120
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: fit
5
+ version: !ruby/object:Gem::Version
6
+ version: "1.1"
7
+ date: 2006-05-21 00:00:00 +02:00
8
+ summary: A Ruby port of FIT (Framework for Integrated Testing)
9
+ require_paths:
10
+ - lib
11
+ email: giulio.piancastelli@gmail.com
12
+ homepage: http://fit.rubyforge.org/
13
+ rubyforge_project: fit
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ signing_key:
28
+ cert_chain:
29
+ authors:
30
+ - Giulio Piancastelli
31
+ files:
32
+ - bin/fit
33
+ - bin/fit.cgi
34
+ - bin/FitServer.rb
35
+ - lib/eg
36
+ - lib/fat
37
+ - lib/fit
38
+ - lib/fittask.rb
39
+ - lib/eg/net
40
+ - lib/eg/music
41
+ - lib/eg/example_tests.rb
42
+ - lib/eg/binary_chop.rb
43
+ - lib/eg/sqrt.rb
44
+ - lib/eg/all_combinations.rb
45
+ - lib/eg/arithmetic_fixture.rb
46
+ - lib/eg/all_pairs.rb
47
+ - lib/eg/nested
48
+ - lib/eg/all_files.rb
49
+ - lib/eg/calculator.rb
50
+ - lib/eg/page.rb
51
+ - lib/eg/column_index.rb
52
+ - lib/eg/echo_args_fixture.rb
53
+ - lib/eg/arithmetic_column_fixture.rb
54
+ - lib/eg/division.rb
55
+ - lib/eg/net/simulator.rb
56
+ - lib/eg/music/browser.rb
57
+ - lib/eg/music/music_player.rb
58
+ - lib/eg/music/music.rb
59
+ - lib/eg/music/simulator.rb
60
+ - lib/eg/music/display.rb
61
+ - lib/eg/music/music_library.rb
62
+ - lib/eg/music/realtime.rb
63
+ - lib/eg/music/Music.txt
64
+ - lib/eg/nested/bob.rb
65
+ - lib/eg/nested/bob_the_builder_fixture.rb
66
+ - lib/fat/html_to_text_fixture.rb
67
+ - lib/fat/reference_fixture.rb
68
+ - lib/fat/string_writer.rb
69
+ - lib/fat/divide.rb
70
+ - lib/fat/money.rb
71
+ - lib/fat/color.rb
72
+ - lib/fat/fixture_name_fixture.rb
73
+ - lib/fat/table.rb
74
+ - lib/fat/standard_annotation_fixture.rb
75
+ - lib/fat/output_fixture.rb
76
+ - lib/fat/table_parse_fixture.rb
77
+ - lib/fat/equals.rb
78
+ - lib/fat/document_parse_fixture.rb
79
+ - lib/fat/annotation_fixture.rb
80
+ - lib/fat/parse_fixture.rb
81
+ - lib/fat/text_to_html_fixture.rb
82
+ - lib/fit/fixture.rb
83
+ - lib/fit/timed_action_fixture.rb
84
+ - lib/fit/row_fixture.rb
85
+ - lib/fit/file_runner.rb
86
+ - lib/fit/fit_server.rb
87
+ - lib/fit/primitive_fixture.rb
88
+ - lib/fit/summary.rb
89
+ - lib/fit/type_adapter.rb
90
+ - lib/fit/scientific_double.rb
91
+ - lib/fit/parse.rb
92
+ - lib/fit/import_fixture.rb
93
+ - lib/fit/fit_protocol.rb
94
+ - lib/fit/wiki_runner.rb
95
+ - lib/fit/fixture_loader.rb
96
+ - lib/fit/column_fixture.rb
97
+ - lib/fit/action_fixture.rb
98
+ - test/fit_server_test.rb
99
+ - test/file_runner_test.rb
100
+ - test/fixtures
101
+ - test/all_tests.rb
102
+ - test/parse_test.rb
103
+ - test/scientific_double_test.rb
104
+ - test/framework_test.rb
105
+ - test/fixture_test.rb
106
+ - test/row_fixture_test.rb
107
+ - test/fixture_loader_test.rb
108
+ - test/type_adapter_test.rb
109
+ - test/fixtures/pass_fixture.rb
110
+ - test/fixtures/fail_fixture.rb
111
+ - doc/spec
112
+ - doc/fitnesse
113
+ - doc/examples
114
+ - doc/spec/parse.html
115
+ - doc/spec/annotation.html
116
+ - doc/spec/index.html
117
+ - doc/spec/fixtures.html
118
+ - doc/spec/extensions.html
119
+ - doc/fitnesse/FitNesse.RubY.AcceptanceTests.ImportFixture.html
120
+ - doc/fitnesse/FitNesse.RubY.AcceptanceTests.WaysToSpecifyaFixtureNamespace.html
121
+ - doc/fitnesse/FitNesse.RubY.AcceptanceTests.GracefulFixtureNames.html
122
+ - doc/fitnesse/FitNesse.RubY.AcceptanceTests.GracefulMemberNames.html
123
+ - doc/fitnesse/FitNesse.RubY.AcceptanceTests.FixtureParameters.html
124
+ - doc/examples/AllPairs.html
125
+ - doc/examples/arithmetic.html
126
+ - doc/examples/NetworkExample.html
127
+ - doc/examples/files
128
+ - doc/examples/ColumnIndex.html
129
+ - doc/examples/FitAcceptanceTests.html
130
+ - doc/examples/GeoCoordinate.html
131
+ - doc/examples/BinaryChop.html
132
+ - doc/examples/MusicExampleWithErrors.html
133
+ - doc/examples/AllPairs
134
+ - doc/examples/CalculatorExample.html
135
+ - doc/examples/WebPageExample.html
136
+ - doc/examples/AllCombinations.html
137
+ - doc/examples/logo.gif
138
+ - doc/examples/AllFiles.html
139
+ - doc/examples/ExampleTests.html
140
+ - doc/examples/MusicExample.html
141
+ - doc/examples/files/hp35bk.jpg
142
+ - doc/examples/AllPairs/sign
143
+ - doc/examples/AllPairs/function
144
+ - doc/examples/AllPairs/magnitude
145
+ - doc/examples/AllPairs/sign/no-change.html
146
+ - doc/examples/AllPairs/sign/multiply.html
147
+ - doc/examples/AllPairs/sign/change-sign.html
148
+ - doc/examples/AllPairs/function/cosine.html
149
+ - doc/examples/AllPairs/function/sine.html
150
+ - doc/examples/AllPairs/magnitude/30.html
151
+ - doc/examples/AllPairs/magnitude/90-30.html
152
+ - doc/examples/AllPairs/magnitude/360+30.html
153
+ - doc/examples/AllPairs/magnitude/180+30.html
154
+ - Rakefile
155
+ - README.txt
156
+ test_files:
157
+ - test/all_tests.rb
158
+ rdoc_options: []
159
+ extra_rdoc_files:
160
+ - README.txt
161
+ executables:
162
+ - fit
163
+ extensions: []
164
+ requirements: []
165
+ dependencies: []