Skip to content

Commit bde4258

Browse files
committed
adding default ct to challenge the matching mechanism
1 parent 24baadf commit bde4258

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/testing/constructortests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,36 @@ public SubclassConstructorTest(Exception v)
5050
this.value = v;
5151
}
5252
}
53+
public class ToDoubleConstructorTest
54+
{
55+
public ToDoubleConstructorTest()
56+
{
57+
//Just default values
58+
}
59+
public ToDoubleConstructorTest(string a, double b,string c)
60+
{
61+
this.a = a;
62+
this.b = b;
63+
this.c = c;
64+
}
65+
public string a;
66+
public double b;
67+
public string c;
68+
}
69+
public class ToFloatConstructorTest
70+
{
71+
public ToFloatConstructorTest()
72+
{
73+
// just default values.
74+
}
75+
public ToFloatConstructorTest(string a, float b, string c)
76+
{
77+
this.a = a;
78+
this.b = b;
79+
this.c = c;
80+
}
81+
public string a;
82+
public float b;
83+
public string c;
84+
}
5385
}

src/tests/test_constructors.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,18 @@ class sub(System.Exception):
4444

4545
instance = sub()
4646
ob = SubclassConstructorTest(instance)
47-
print(ob)
4847
self.assertTrue(isinstance(ob.value, System.Exception))
4948

49+
def testIntToDoubleConstructorArguments(self):
50+
from Python.Test import ToDoubleConstructorTest
51+
52+
o = ToDoubleConstructorTest('a',2,'c')
53+
self.assertEqual(o.a,'a')
54+
self.assertAlmostEqual(o.b,2)
55+
self.assertEqual(o.c,'c')
56+
57+
o = ToDoubleConstructorTest()
58+
5059

5160
def test_suite():
5261
return unittest.makeSuite(ConstructorTests)

0 commit comments

Comments
 (0)