Changeset 59
- Timestamp:
- 06/27/08 03:00:48 (2 months ago)
- Files:
-
- trunk/examples/util/serializer/FunctionTest.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/util/serializer/FunctionTest.d
r54 r59 319 319 } 320 320 321 interface IInterface { 322 void aMethod(); 323 } 324 325 class ClassWithInterface : IInterface { 326 int x; int y; int z; 327 328 this() {} 329 this(int x_, int y_, int z_) { 330 x = x_; y = y_; z = z_; 331 } 332 int opEquals(ClassWithInterface test) { 333 if (test.x == x && 334 test.y == y && 335 test.z == z) return 1; 336 return 0; 337 } 338 339 override void aMethod() { x = 99; } 340 } 341 342 343 321 344 //------------------------------------------------------------------------------ 322 345 … … 648 671 //------------------------------------------------------------------------------ 649 672 673 unittest { testCase.execute("load/dump - classes with interfaces", { 674 alias ClassWithInterface TestT; 675 alias serializer S; 676 TestT input; 677 string output; 678 679 input = new TestT(8,-43,2); 680 output = S.dump(input); 681 assert(S.load!(TestT)(output) == input); 682 });} 683 684 685 //------------------------------------------------------------------------------ 686 650 687 unittest { testCase.execute("load/dump - transparent structs", { 651 688 TransparentStruct input; … … 963 1000 assert(serializer.load!(MyClass)(output) == input); 964 1001 });} 1002 965 1003 966 1004 //------------------------------------------------------------------------------ … … 1310 1348 == new TransparentClass(50, 4.5, "another text", 25, -1)); 1311 1349 });} 1350 1351 //------------------------------------------------------------------------------ 1352 1353 unittest { testCase.execute("load/dump - classes with interfaces", { 1354 alias ClassWithInterface TestT; 1355 alias jsonserializer S; 1356 TestT input; 1357 string output; 1358 1359 input = new TestT(8,-43,2); 1360 output = S.dump(input); 1361 assert(S.load!(TestT)(output) == input); 1362 });} 1363 1312 1364 1313 1365 //------------------------------------------------------------------------------ … … 2027 2079 //------------------------------------------------------------------------------ 2028 2080 2081 unittest { testCase.execute("load/dump - classes with interfaces", { 2082 alias ClassWithInterface TestT; 2083 alias binserializer S; 2084 TestT input; 2085 S.STORAGETYPE output; 2086 2087 input = new TestT(8,-43,2); 2088 output = S.dump(input); 2089 assert(S.load!(TestT)(output) == input); 2090 });} 2091 2092 //------------------------------------------------------------------------------ 2093 2029 2094 unittest { testCase.execute("load/dump - transparent structs", { 2030 2095 TransparentStruct input;
