1# @file    TestValidation.rb
2# @brief   Validation of Date ModelCreator and ModelHistory unit tests
3#
4# @author  Akiya Jouraku (Ruby conversion)
5# @author  Sarah Keating
6#
7#
8# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
9#
10# DO NOT EDIT THIS FILE.
11#
12# This file was generated automatically by converting the file located at
13# src/annotation/test/TestValidation.cpp
14# using the conversion program dev/utilities/translateTests/translateTests.pl.
15# Any changes made here will be lost the next time the file is regenerated.
16#
17# -----------------------------------------------------------------------------
18# This file is part of libSBML.  Please visit http://sbml.org for more
19# information about SBML, and the latest version of libSBML.
20#
21# Copyright 2005-2010 California Institute of Technology.
22# Copyright 2002-2005 California Institute of Technology and
23#                     Japan Science and Technology Corporation.
24#
25# This library is free software; you can redistribute it and/or modify it
26# under the terms of the GNU Lesser General Public License as published by
27# the Free Software Foundation.  A copy of the license agreement is provided
28# in the file named "LICENSE.txt" included with this software distribution
29# and also available online as http://sbml.org/software/libsbml/license.html
30# -----------------------------------------------------------------------------
31require 'test/unit'
32require 'libSBML'
33
34class TestValidation < Test::Unit::TestCase
35
36  def test_Validation_CVTerm1
37    cv = LibSBML::CVTerm.new()
38    assert( cv != nil )
39    assert_equal false, (cv.hasRequiredAttributes())
40    cv.setQualifierType(LibSBML::MODEL_QUALIFIER)
41    assert_equal false, (cv.hasRequiredAttributes())
42    cv.setModelQualifierType(LibSBML::BQM_IS)
43    assert_equal false, (cv.hasRequiredAttributes())
44    cv.addResource("ggg")
45    assert_equal true, (cv.hasRequiredAttributes())
46    cv = nil
47  end
48
49  def test_Validation_CVTerm2
50    cv = LibSBML::CVTerm.new()
51    assert( cv != nil )
52    assert_equal false, (cv.hasRequiredAttributes())
53    cv.setQualifierType(LibSBML::BIOLOGICAL_QUALIFIER)
54    assert_equal false, (cv.hasRequiredAttributes())
55    cv.setBiologicalQualifierType(LibSBML::BQB_IS)
56    assert_equal false, (cv.hasRequiredAttributes())
57    cv.addResource("ggg")
58    assert_equal true, (cv.hasRequiredAttributes())
59    cv = nil
60  end
61
62  def test_Validation_Date1
63    date = LibSBML::Date.new(200,12,30,12,15,45,1,2,0)
64    assert( date != nil )
65    assert_equal false, (date.representsValidDate())
66    date = nil
67  end
68
69  def test_Validation_Date2
70    date = LibSBML::Date.new(2007,14,30,12,15,45,1,2,0)
71    assert( date != nil )
72    assert_equal false, (date.representsValidDate())
73    date = nil
74  end
75
76  def test_Validation_Date3
77    date = LibSBML::Date.new("Jan 12")
78    assert( date != nil )
79    assert_equal false, (date.representsValidDate())
80    date = nil
81  end
82
83  def test_Validation_Date4
84    date = LibSBML::Date.new(2007,12,30,12,15,45,1,2,0)
85    assert( date != nil )
86    assert_equal true, date.representsValidDate()
87    date = nil
88  end
89
90  def test_Validation_ModelCreator
91    mc = LibSBML::ModelCreator.new()
92    assert( mc != nil )
93    assert_equal false, (mc.hasRequiredAttributes())
94    mc.setEmail("k123")
95    assert_equal false, (mc.hasRequiredAttributes())
96    mc.setFamilyName("Keating")
97    assert_equal false, (mc.hasRequiredAttributes())
98    mc.setGivenName("Sarah")
99    assert_equal true, mc.hasRequiredAttributes()
100    mc = nil
101  end
102
103  def test_Validation_ModelHistory1
104    mh = LibSBML::ModelHistory.new()
105    assert( mh != nil )
106    assert_equal false, (mh.hasRequiredAttributes())
107    date = LibSBML::Date.new(2007,12,30,12,15,45,1,2,0)
108    mh.setCreatedDate(date)
109    assert_equal false, (mh.hasRequiredAttributes())
110    mh.setModifiedDate(date)
111    assert_equal false, (mh.hasRequiredAttributes())
112    mc = LibSBML::ModelCreator.new()
113    mc.setFamilyName("Keating")
114    mc.setGivenName("Sarah")
115    mh.addCreator(mc)
116    assert_equal true, mh.hasRequiredAttributes()
117    mh = nil
118  end
119
120  def test_Validation_ModelHistory2
121    mh = LibSBML::ModelHistory.new()
122    assert( mh != nil )
123    assert_equal false, (mh.hasRequiredAttributes())
124    date = LibSBML::Date.new(200,12,30,12,15,45,1,2,0)
125    mh.setCreatedDate(date)
126    assert_equal false, (mh.hasRequiredAttributes())
127    mh.setModifiedDate(date)
128    assert_equal false, (mh.hasRequiredAttributes())
129    mc = LibSBML::ModelCreator.new()
130    mc.setFamilyName("Keating")
131    mc.setGivenName("Sarah")
132    mh.addCreator(mc)
133    assert_equal false, (mh.hasRequiredAttributes())
134    mh = nil
135  end
136
137  def test_Validation_ModelHistory3
138    mh = LibSBML::ModelHistory.new()
139    assert( mh != nil )
140    assert_equal false, (mh.hasRequiredAttributes())
141    date = LibSBML::Date.new(2007,12,30,12,15,45,1,2,0)
142    mh.setCreatedDate(date)
143    assert_equal false, (mh.hasRequiredAttributes())
144    mh.setModifiedDate(date)
145    assert_equal false, (mh.hasRequiredAttributes())
146    mc = LibSBML::ModelCreator.new()
147    mc.setFamilyName("Keating")
148    mh.addCreator(mc)
149    assert_equal false, (mh.hasRequiredAttributes())
150    mh = nil
151  end
152
153end
154
155