Merge branch 'vadz-add-nested-in-template-test'

* vadz-add-nested-in-template-test:
  Avoid comparing doubles in nested_in_template.i unit test
  Add recently added nested_in_template to the list of test cases
This commit is contained in:
William S Fulton 2018-12-06 07:21:04 +00:00
commit 525c757322
4 changed files with 7 additions and 6 deletions

View file

@ -321,6 +321,7 @@ CPP_TEST_CASES += \
nested_directors \ nested_directors \
nested_comment \ nested_comment \
nested_ignore \ nested_ignore \
nested_in_template \
nested_scope \ nested_scope \
nested_template_base \ nested_template_base \
nested_workaround \ nested_workaround \

View file

@ -3,8 +3,8 @@ using nested_in_templateNamespace;
public class runme { public class runme {
static void Main() { static void Main() {
var cd = new OuterTemplate1.ConcreteDerived(8.8); var cd = new OuterTemplate1.ConcreteDerived(88);
if (cd.m_value != 8.8) if (cd.m_value != 88)
throw new Exception("ConcreteDerived not created correctly"); throw new Exception("ConcreteDerived not created correctly");
} }
} }

View file

@ -20,13 +20,13 @@ struct OuterTemplate<1>
struct ConcreteDerived : AbstractBase struct ConcreteDerived : AbstractBase
{ {
ConcreteDerived() : m_value(0.) {} ConcreteDerived() : m_value(0.) {}
explicit ConcreteDerived(double value) : m_value(value) {} explicit ConcreteDerived(int value) : m_value(value) {}
virtual bool IsSameAs(const AbstractBase& other) const { virtual bool IsSameAs(const AbstractBase& other) const {
return m_value == static_cast<const ConcreteDerived&>(other).m_value; return m_value == static_cast<const ConcreteDerived&>(other).m_value;
} }
double m_value; int m_value;
}; };
}; };
%} %}

View file

@ -1,5 +1,5 @@
from nested_in_template import * from nested_in_template import *
cd = ConcreteDerived(8.8) cd = ConcreteDerived(88)
if cd.m_value != 8.8: if cd.m_value != 88:
raise RuntimeError("ConcreteDerived not created correctly") raise RuntimeError("ConcreteDerived not created correctly")