Changeset 320 for ruby/trunk/lib/adl_parser/test/scanner_test.rb
- Timestamp:
- Oct 15, 2009, 7:28:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/adl_parser/test/scanner_test.rb
r319 r320 74 74 end 75 75 76 must "assert CADLScanner scanner scan V_STRING" do 77 @scanner.scan("\"string\"") do |sym, val| 78 assert_equal :V_STRING,sym 79 assert_equal "string",val 80 end 81 @scanner.scan("\"1605E211E9BFB4093A72CCE7A9792FF9\"") do |sym, val| 82 assert_equal :V_STRING,sym 83 assert_equal "1605E211E9BFB4093A72CCE7A9792FF9",val 84 end 85 end 86 76 87 must "assert CADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do 77 88 @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val| 78 89 assert_equal :V_QUALIFIED_TERM_CODE_REF,sym 79 90 assert_equal "ICD10AM(1998)::F23",val 91 end 92 end 93 94 95 must "assert CADLScanner scanner scan V_ISO8601_DURATION_CONSTRAINT_PATTERN" do 96 @scanner.scan("PW") do |sym, val| 97 assert_equal :V_ISO8601_DURATION_CONSTRAINT_PATTERN,sym 98 assert_equal "PW",val 99 end 100 @scanner.scan("PTs") do |sym, val| 101 assert_equal :V_ISO8601_DURATION_CONSTRAINT_PATTERN,sym 102 assert_equal "PTs",val 80 103 end 81 104 end … … 89 112 @scanner.scan("P1D") do |sym, val| 90 113 assert_equal :V_ISO8601_DURATION,sym 91 assert_equal "PT1M",val 114 assert_equal "P1D",val 115 end 116 117 @scanner.scan("PT1H30M") do |sym, val| 118 assert_equal :V_ISO8601_DURATION,sym 119 assert_equal "PT1H30M",val 92 120 end 93 121 end 94 122 95 must "assert CADLScanner scanner scan V_STRING" do 96 @scanner.scan("\"string\"") do |sym, val| 97 assert_equal :V_STRING,sym 98 assert_equal "string",val 99 end 100 @scanner.scan("\"1605E211E9BFB4093A72CCE7A9792FF9\"") do |sym, val| 101 assert_equal :V_STRING,sym 102 assert_equal "1605E211E9BFB4093A72CCE7A9792FF9",val 123 must "assert CADLScanner scanner scan V_ISO8601_EXTENDED_DATE_TIME" do 124 @scanner.scan("2000-01-01T01:00:00") do |sym, val| 125 assert_equal :V_ISO8601_EXTENDED_DATE_TIME,sym 126 assert_equal "2000-01-01T01:00:00",val 103 127 end 104 128 end 105 129 106 must "assert CADLScanner scanner scan V_ISO8601_DURATION_CONSTRAINT_PATTERN" do107 @scanner.scan("PW") do |sym, val|108 assert_equal :V_ISO8601_DURATION_CONSTRAINT_PATTERN,sym109 assert_equal "PW",val110 end111 end112 130 end 113 131 … … 155 173 end 156 174 end 175 176 class RegexScannerTest < Test::Unit::TestCase 177 def setup 178 @scanner = OpenEhr::ADL::Scanner::RegexScanner.new([:regexp], "filename") 179 end 180 181 must "assert RegexScanner scanner scan " do 182 @scanner.scan("this|that|something else") do |sym, val| 183 assert_equal :REGEXP_BODY,sym 184 assert_equal "this|that|something else",val 185 end 186 end 187 end
Note:
See TracChangeset
for help on using the changeset viewer.