This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for long.toString with long construction issue #43
- Loading branch information
Showing
6 changed files
with
524 additions
and
0 deletions.
There are no files selected for viewing
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,4 @@ | ||
3 | ||
0 | ||
3 | ||
0 |
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,46 @@ | ||
class TestInt { | ||
void run() { | ||
Map<int,int> map = new Map<int,int>(); | ||
int b = 3; | ||
print(b.toString()); | ||
print(self.func().toString()); | ||
} | ||
int func() { | ||
return new int(); | ||
} | ||
} | ||
|
||
class TestLong { | ||
void run() { | ||
Map<long,long> map = new Map<long,long>(); | ||
// the following declaration does not translate to java | ||
// xfail:java | ||
long b = 3; | ||
print(b.toString()); | ||
print(self.func().toString()); | ||
} | ||
long func() { | ||
return new long(); | ||
} | ||
} | ||
|
||
class Test<T> { | ||
void run() { | ||
Map<T,T> map = new Map<T,T>(); | ||
// this bit crashes the compiler so we need an xfail for now | ||
// NOTE: the above xfail:java masks this xfail | ||
// T b = 3; | ||
// print(b.toString()); | ||
// print(self.func().toString()); | ||
} | ||
// T func() { | ||
// return new T(); | ||
// } | ||
} | ||
|
||
void main() { | ||
new TestInt().run(); | ||
new TestLong().run(); | ||
new Test<int>().run(); | ||
new Test<long>().run(); | ||
} |
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,69 @@ | ||
var _qrt = require("quark_runtime.js"); | ||
|
||
// CLASS TestInt | ||
function TestInt() { | ||
this.__init_fields__(); | ||
} | ||
exports.TestInt = TestInt; | ||
|
||
function TestInt__init_fields__() {} | ||
TestInt.prototype.__init_fields__ = TestInt__init_fields__; | ||
|
||
function TestInt_run() { | ||
var map = new Map(); | ||
var b = 3; | ||
_qrt.print(_qrt.toString(b)); | ||
_qrt.print(_qrt.toString((this).func())); | ||
} | ||
TestInt.prototype.run = TestInt_run; | ||
|
||
function TestInt_func() { | ||
return new Number(); | ||
} | ||
TestInt.prototype.func = TestInt_func; | ||
|
||
// CLASS TestLong | ||
function TestLong() { | ||
this.__init_fields__(); | ||
} | ||
exports.TestLong = TestLong; | ||
|
||
function TestLong__init_fields__() {} | ||
TestLong.prototype.__init_fields__ = TestLong__init_fields__; | ||
|
||
function TestLong_run() { | ||
var map = new Map(); | ||
var b = 3; | ||
_qrt.print(_qrt.toString(b)); | ||
_qrt.print(_qrt.toString((this).func())); | ||
} | ||
TestLong.prototype.run = TestLong_run; | ||
|
||
function TestLong_func() { | ||
return new Number(); | ||
} | ||
TestLong.prototype.func = TestLong_func; | ||
|
||
// CLASS Test | ||
function Test() { | ||
this.__init_fields__(); | ||
} | ||
exports.Test = Test; | ||
|
||
function Test__init_fields__() {} | ||
Test.prototype.__init_fields__ = Test__init_fields__; | ||
|
||
function Test_run() { | ||
var map = new Map(); | ||
} | ||
Test.prototype.run = Test_run; | ||
|
||
function main() { | ||
(new TestInt()).run(); | ||
(new TestLong()).run(); | ||
(new Test()).run(); | ||
(new Test()).run(); | ||
} | ||
exports.main = main; | ||
|
||
main(); |
203 changes: 203 additions & 0 deletions
203
quark/test/emit/builtin_numbers/js/node_modules/quark_runtime.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from quark_runtime import * | ||
|
||
class TestInt(object): | ||
def _init(self): pass | ||
def __init__(self): self._init() | ||
|
||
def run(self): | ||
map = _Map(); | ||
b = 3; | ||
_println(str(b)); | ||
_println(str((self).func())); | ||
|
||
def func(self): | ||
return int() | ||
|
||
|
||
class TestLong(object): | ||
def _init(self): pass | ||
def __init__(self): self._init() | ||
|
||
def run(self): | ||
map = _Map(); | ||
b = 3; | ||
_println(str(b)); | ||
_println(str((self).func())); | ||
|
||
def func(self): | ||
return long() | ||
|
||
|
||
class Test(object): | ||
def _init(self): pass | ||
def __init__(self): self._init() | ||
|
||
def run(self): | ||
map = _Map(); | ||
|
||
|
||
|
||
def main(): | ||
(TestInt()).run(); | ||
(TestLong()).run(); | ||
(Test()).run(); | ||
(Test()).run(); | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.