Skip to content

Commit

Permalink
added tests for shared and Unique trait varants
Browse files Browse the repository at this point in the history
  • Loading branch information
LostbBlizzard committed Aug 31, 2024
1 parent 22f520f commit 9754d16
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions UCodeAPI/StandardLibrary/src/Tests/Shared_ptr.uc
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,19 @@ Tests:

ret p.RefCount() == 2 && oldcount == 1;

[Test]
|Shared_ptr_3[]:
$Item trait export:
dynamic |SomeFunc[this&] -> int;

$SomeType[Item] export:
int somevalue = 0;
|new[this&,int value]:
somevalue = value;

|SomeFunc[this&] -> int:ret somevalue;

dynamic<Item>$ ptr = unq SomeType(10);


//ret ptr~>SomeFunc() == 10;
17 changes: 17 additions & 0 deletions UCodeAPI/StandardLibrary/src/Tests/Unique_ptr.uc
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,20 @@ Tests:
Swap(Vptr,Bptr);

ret Vptr~>X == Bptr~>Y && Vptr~>Y == Bptr~>X && Bptr~>X == 8;

[Test]
|Unique_ptr_6[]:
$Item trait export:
dynamic |SomeFunc[this&] -> int;

$SomeType[Item] export:
int somevalue = 0;
|new[this&,int value]:
somevalue = value;

|SomeFunc[this&] -> int:ret somevalue;

dynamic<Item>^ ptr = unq SomeType(10);


//ret ptr~>SomeFunc() == 10;

0 comments on commit 9754d16

Please sign in to comment.