mirror of https://github.com/swig/swig
Avoid comparing doubles in nested_in_template.i unit test
This should also have been part of
30bb977a64
See #1358.
This commit is contained in:
parent
73ea48ba4a
commit
5e7426dcc6
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue