Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Add a test for long.toString with long construction issue #43
Browse files Browse the repository at this point in the history
  • Loading branch information
bozzzzo committed Oct 28, 2015
1 parent ce3946d commit df52236
Show file tree
Hide file tree
Showing 6 changed files with 524 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quark/test/emit/builtin_numbers.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3
0
3
0
46 changes: 46 additions & 0 deletions quark/test/emit/builtin_numbers.q
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();
}
69 changes: 69 additions & 0 deletions quark/test/emit/builtin_numbers/js/builtin_numbers.js
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 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.

48 changes: 48 additions & 0 deletions quark/test/emit/builtin_numbers/py/builtin_numbers.py
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()
Loading

0 comments on commit df52236

Please sign in to comment.