template template parameters patch tidyup
- Document change in CHANGES file - Minor tweaks and whitespace fixes in stype.c - Enhance testcase - Synchronise Java and Python runt test in testcase
This commit is contained in:
parent
cbfc0d15b1
commit
b3bc87d551
5 changed files with 59 additions and 31 deletions
|
|
@ -29,12 +29,17 @@ public class template_template_parameters_runme {
|
|||
|
||||
// Test second part
|
||||
FloatTestStruct floatTestStruct = new FloatTestStruct();
|
||||
FloatContainer2 floatContainer2 = floatTestStruct.getX();
|
||||
FloatContainer2 floatContainer2 = floatTestStruct.getX();
|
||||
floatContainer2.setX(8.1f);
|
||||
IntTestStruct intTestStruct = new IntTestStruct();
|
||||
IntContainer1 intContainer1 = intTestStruct.getX();
|
||||
IntContainer1 intContainer1 = intTestStruct.getX();
|
||||
intContainer1.setX(91);
|
||||
if (intContainer1.getX()!=91)
|
||||
if (intContainer1.getX() != 91)
|
||||
throw new RuntimeException("Failed");
|
||||
if (intTestStruct.getX().getX() != 91)
|
||||
throw new RuntimeException("Failed");
|
||||
IntTestStruct intTestStructReturned = template_template_parameters.TestStructContainer1Method(intTestStruct);
|
||||
if (intTestStructReturned.getX().getX() != 101)
|
||||
throw new RuntimeException("Failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,18 @@
|
|||
from template_template_parameters import *
|
||||
|
||||
# Test first part
|
||||
listBool = ListFastBool()
|
||||
listBool.item = True
|
||||
x_boolean = listBool.allotype
|
||||
if listBool.item != True:
|
||||
raise RuntimeError("Failed")
|
||||
|
||||
listDouble = ListDefaultDouble()
|
||||
listDouble.item = 10.2
|
||||
x_double = listDouble.allotype
|
||||
if listDouble.item != 10.2:
|
||||
raise RuntimeError("Failed")
|
||||
|
||||
# Test second part
|
||||
floatTestStruct = FloatTestStruct()
|
||||
floatContainer2 = floatTestStruct.x
|
||||
|
|
@ -7,8 +20,11 @@ floatContainer2.x = 8.1
|
|||
intTestStruct = IntTestStruct()
|
||||
intContainer1 = intTestStruct.x
|
||||
intContainer1.x = 91
|
||||
if intContainer1.x!=91:
|
||||
raise RuntimeError("Failed")
|
||||
if intTestStruct.x.x!=91:
|
||||
raise RuntimeError("Failed")
|
||||
if intContainer1.x != 91:
|
||||
raise RuntimeError("Failed")
|
||||
if intTestStruct.x.x != 91:
|
||||
raise RuntimeError("Failed")
|
||||
intTestStructReturned = TestStructContainer1Method(intTestStruct)
|
||||
if intTestStructReturned.x.x != 101:
|
||||
raise RuntimeError("Failed")
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ struct TestStruct {
|
|||
TemplateTemplateT<BaseT> x;
|
||||
};
|
||||
|
||||
TestStruct<int, Container1> TestStructContainer1Method(TestStruct<int, Container1> ts1) {
|
||||
ts1.x.x += 10;
|
||||
return ts1;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/* part 1 */
|
||||
|
|
@ -61,8 +66,8 @@ struct TestStruct {
|
|||
%template(DoubleAllocFast) pfc::alloc_fast<double>;
|
||||
|
||||
/* part 2 */
|
||||
%template(IntTestStruct) TestStruct<int, Container1>;
|
||||
%template(FloatTestStruct) TestStruct<float, Container2>;
|
||||
%template(IntContainer1) Container1<int>;
|
||||
%template(FloatContainer2) Container2<float>;
|
||||
%template(IntTestStruct) TestStruct<int, Container1>;
|
||||
%template(FloatTestStruct) TestStruct<float, Container2>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue