-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vtable overrides for cmp* and is_equal* with tests
- Loading branch information
Showing
9 changed files
with
1,264 additions
and
980 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_cmp { | ||
function test_mpz_cmp() { | ||
var x = new GMP.Integer(30); | ||
var y = new GMP.Integer(29); | ||
int i = x > y; | ||
self.assert.is_true(x > y); | ||
y = new GMP.Integer(31); | ||
self.assert.is_true(x < y); | ||
y = new GMP.Integer(30); | ||
self.assert.is_true(x == y); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_cmp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_cmp_num { | ||
function test_mpz_cmp_num() { | ||
var x = new GMP.Integer(30); | ||
int y = 29; | ||
int i = x > y; | ||
self.assert.is_true(x > y); | ||
y = 31; | ||
self.assert.is_true(x < y); | ||
y = 30; | ||
self.assert.is_true(x == y); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_cmp_num); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_cmp_string { | ||
function test_mpz_cmp_string() { | ||
var x = new GMP.Integer(30); | ||
string y = "29"; | ||
int i = x > y; | ||
self.assert.is_true(x > y); | ||
y = "31"; | ||
self.assert.is_true(x < y); | ||
y = "30"; | ||
self.assert.is_true(x == y); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_cmp_string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_is_equal { | ||
function test_mpz_is_equal() { | ||
var x = new GMP.Integer(30); | ||
var y = new GMP.Integer(30); | ||
self.assert.equal(x, y); | ||
y = new GMP.Integer(-24); | ||
self.assert.not_equal(x, y); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_is_equal); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_is_equal_num { | ||
function test_mpz_is_equal_num() { | ||
var x = new GMP.Integer(30); | ||
int y = 30; | ||
int i = x == y; | ||
self.assert.equal(i, 1); | ||
y = -24; | ||
i = x == y; | ||
self.assert.equal(i, 0); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_is_equal_num); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$load "rosella/test.pbc"; | ||
$load "GMP/Integer.pbc"; | ||
|
||
namespace GMP { | ||
class Integer; | ||
} | ||
|
||
class Test_GMP_Vtable_is_equal_string { | ||
function test_mpz_is_equal_string() { | ||
var x = new GMP.Integer(30); | ||
string y = "30"; | ||
int i = x == y; | ||
self.assert.equal(i, 1); | ||
y = "-24"; | ||
i = x == y; | ||
self.assert.equal(i, 0); | ||
} | ||
} | ||
|
||
function main[main]() { | ||
using Rosella.Test.test; | ||
test(class Test_GMP_Vtable_is_equal_string); | ||
} |