require 'test/unit' require 'am.rb' require 'rm.rb' class ArchetypeModelTest < Test::Unit::TestCase def setup @archetype = OpenEHR::AM::Archetype::Archetype.new(nil,nil,nil,nil,nil,nil,nil,nil) @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::Archetype_Description.new @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::Archetype_Constraint.new @assertion = OpenEHR::AM::Archetype::Constraint_Model::Assertion::Assertion.new @c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Primitive.new @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean.new(true, true, true) @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Integer.new @archetype_ontology = OpenEHR::AM::Archetype::Ontology::Archetype_Ontology.new end def test_init assert_instance_of OpenEHR::AM::Archetype::Ontology::Archetype_Ontology, @archetype_ontology assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Archetype_Constraint, @archetype_constraint assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::Archetype_Description, @archetype_description assert_instance_of OpenEHR::AM::Archetype::Archetype, @archetype assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Assertion::Assertion, @assertion assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Primitive, @c_primitive assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean, @c_boolean end def test_primitive assert @c_boolean.true_valid? assert @c_boolean.false_valid? assert @c_boolean.assumed_value assert @c_boolean.has_assumed_value? assert @c_boolean.default_value assert @c_boolean.default_value(true) assert_raise(ArgumentError) {@c_boolean.set_true_valid(false); @c_boolean.set_false_valid(false)} assert_raise(ArgumentError) {OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean.new(false,false,false)} end end