1 | require File.dirname(__FILE__) + '/test_helper.rb'
|
---|
2 |
|
---|
3 | class RemoteADLTest < Test::Unit::TestCase
|
---|
4 | def setup
|
---|
5 | @ehr_adls = []
|
---|
6 | ehr_dirs = ["cluster", "composition", "element", "entry", "section", "structure"]
|
---|
7 | ehr_dirs.each do |dir|
|
---|
8 | doc = Hpricot( open("http://www.openehr.org/svn/knowledge/archetypes/dev/adl/openehr/ehr/#{dir}").read )
|
---|
9 | (doc/:a).each do |link|
|
---|
10 | if link[:href] =~ /.*\.adl\Z/
|
---|
11 | @ehr_adls << "http://www.openehr.org/svn/knowledge/archetypes/dev/adl/openehr/ehr/#{dir}/#{$~}"
|
---|
12 | end
|
---|
13 | end
|
---|
14 | end
|
---|
15 |
|
---|
16 | @test_adls = []
|
---|
17 | test_dirs = ["basics","clinical_types","dadl","description","generic_types","language","non-conforming","paths","rm_checking","slots","specialisation","structure","terminology","unicode","validation"]
|
---|
18 | test_dirs.each do |dir|
|
---|
19 | doc = Hpricot( open("http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/#{dir}").read )
|
---|
20 | (doc/:a).each do |link|
|
---|
21 | if link[:href] =~ /.*\.adl\Z/
|
---|
22 | @test_adls << "http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/#{dir}/#{$~}"
|
---|
23 | end
|
---|
24 | end
|
---|
25 | end
|
---|
26 | @parser = ::OpenEhr::ADL::Parser.new
|
---|
27 | end
|
---|
28 |
|
---|
29 |
|
---|
30 | # must "test_adls should properly parsed" do
|
---|
31 | # assert_nothing_raised do
|
---|
32 | # @test_adls.each do |adl|
|
---|
33 | # puts "Processing #{adl}"
|
---|
34 | # open(adl) do |file|
|
---|
35 | # p "Processing #{file.gets}"
|
---|
36 | # case file.gets
|
---|
37 | # when "http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/basics/adl-test-ENTRY.basic_types_fail.v1.adl"
|
---|
38 | # assert_raise Racc::ParserError do
|
---|
39 | # @parser.parse(file.read, adl)
|
---|
40 | # end
|
---|
41 | # else
|
---|
42 | # assert_nothing_raised { @parser.parse(file.read, adl) }
|
---|
43 | # end
|
---|
44 | # end
|
---|
45 | # end
|
---|
46 | # end
|
---|
47 | # end
|
---|
48 |
|
---|
49 | must "ehr_adls should properly parsed" do
|
---|
50 | assert_nothing_raised do
|
---|
51 | @ehr_adls.each do |adl|
|
---|
52 | puts "Processing #{adl}"
|
---|
53 | open(adl) do |file|
|
---|
54 | assert_nothing_raised do
|
---|
55 | @parser.parse(file.read, adl)
|
---|
56 | end
|
---|
57 | end
|
---|
58 | end
|
---|
59 | end
|
---|
60 | end
|
---|
61 |
|
---|
62 |
|
---|
63 | end
|
---|