Skip to content

Constructor argument matching supports simple int to (float|double) types #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adding default ct to challenge the matching mechanism
  • Loading branch information
sigbjorn committed Jul 3, 2016
commit bde42585a297cf57a8aca30d42f63cccfdd83df3
32 changes: 32 additions & 0 deletions src/testing/constructortests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,36 @@ public SubclassConstructorTest(Exception v)
this.value = v;
}
}
public class ToDoubleConstructorTest
{
public ToDoubleConstructorTest()
{
//Just default values
}
public ToDoubleConstructorTest(string a, double b,string c)
{
this.a = a;
this.b = b;
this.c = c;
}
public string a;
public double b;
public string c;
}
public class ToFloatConstructorTest
{
public ToFloatConstructorTest()
{
// just default values.
}
public ToFloatConstructorTest(string a, float b, string c)
{
this.a = a;
this.b = b;
this.c = c;
}
public string a;
public float b;
public string c;
}
}
11 changes: 10 additions & 1 deletion src/tests/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@ class sub(System.Exception):

instance = sub()
ob = SubclassConstructorTest(instance)
print(ob)
self.assertTrue(isinstance(ob.value, System.Exception))

def testIntToDoubleConstructorArguments(self):
from Python.Test import ToDoubleConstructorTest

o = ToDoubleConstructorTest('a',2,'c')
self.assertEqual(o.a,'a')
self.assertAlmostEqual(o.b,2)
self.assertEqual(o.c,'c')

o = ToDoubleConstructorTest()


def test_suite():
return unittest.makeSuite(ConstructorTests)
Expand Down