Skip to content

Commit f869c76

Browse files
committed
more bugs
1 parent 1d088f6 commit f869c76

3 files changed

Lines changed: 114 additions & 1 deletion

File tree

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/FrameProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public IlConstHandle BlzCreateFrameByType(ILconstString typeName, ILconstString
2424
return new IlConstHandle("framehandle", new FrameHandle());
2525
}
2626

27+
public IlConstHandle BlzGetFrameByName(ILconstString name, ILconstInt createContext) {
28+
return new IlConstHandle("framehandle", new FrameHandle());
29+
}
30+
2731
public void BlzFrameSetSize(IlConstHandle frame, ILconstReal width, ILconstReal height) {
2832
}
2933

@@ -35,4 +39,6 @@ public IlConstHandle ConvertOriginFrameType(ILconstInt i) {
3539
return new IlConstHandle("frameType", i.getVal());
3640
}
3741

42+
43+
3844
}

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/GenericsWithTypeclassesTests.java

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,113 @@ public void genericClassWithLLModule() {
19221922
);
19231923
}
19241924

1925+
@Test
1926+
public void genericClassWithLLModuleBig() {
1927+
testAssertOkLinesWithStdLib(true,
1928+
"package test",
1929+
"import LinkedListModule",
1930+
"",
1931+
"class Box<T:>",
1932+
" use LinkedListModule",
1933+
" private T value",
1934+
" function setValue(T v)",
1935+
" value = v",
1936+
" function getValue() returns T",
1937+
" return value",
1938+
"",
1939+
"class OtherBox<U:>",
1940+
" use LinkedListModule",
1941+
" private U v",
1942+
" construct(U x)",
1943+
" v = x",
1944+
" function get() returns U",
1945+
" return v",
1946+
"init",
1947+
" foo()",
1948+
"function foo()",
1949+
" // Basic sanity",
1950+
" let b0 = new Box<int>",
1951+
" b0.setValue(42)",
1952+
" if b0.getValue() != 42 or b0.prev != null",
1953+
" return",
1954+
" b0.remove()",
1955+
"",
1956+
" // Build a 3-element list",
1957+
" let b1 = new Box<int>",
1958+
" let b2 = new Box<int>",
1959+
" let b3 = new Box<int>",
1960+
" b1.setValue(1)",
1961+
" b2.setValue(2)",
1962+
" b3.setValue(3)",
1963+
"",
1964+
" // Circular next()",
1965+
" if b1.getNext() != b2 or b2.getNext() != b3 or b3.getNext() != b1",
1966+
" return",
1967+
"",
1968+
" // Circular prev()",
1969+
" if b1.getPrev() != b3 or b2.getPrev() != b1 or b3.getPrev() != b2",
1970+
" return",
1971+
"",
1972+
" // Removal in the middle",
1973+
" b2.remove()",
1974+
" if b1.getNext() != b3 or b3.getPrev() != b1",
1975+
" return",
1976+
"",
1977+
" // Destroy remaining list",
1978+
" destroy b1",
1979+
" destroy b3",
1980+
"",
1981+
" // NEW: Generic OtherBox<T> list",
1982+
" let o1 = new OtherBox<int>(10)",
1983+
" let o2 = new OtherBox<int>(20)",
1984+
" let o3 = new OtherBox<int>(30)",
1985+
"",
1986+
" if o1.getPrev() != o3 or o3.getNext() != o1",
1987+
" return",
1988+
"",
1989+
" // Removal test in OtherBox list",
1990+
" o2.remove()",
1991+
" if o1.getNext() != o3 or o3.getPrev() != o1",
1992+
" return",
1993+
"",
1994+
" destroy o1",
1995+
" destroy o3",
1996+
"",
1997+
" testSuccess()",
1998+
"endpackage"
1999+
);
2000+
}
2001+
2002+
@Test
2003+
public void genericClassWithLLModule1() {
2004+
testAssertOkLinesWithStdLib(true,
2005+
"package test",
2006+
"import LinkedListModule",
2007+
"class Box<T:>",
2008+
" use LinkedListModule",
2009+
"class Box2<T>",
2010+
" use LinkedListModule",
2011+
"init",
2012+
" let b = new Box<int>",
2013+
" let b2 = new Box2<int>",
2014+
" testSuccess()",
2015+
"endpackage"
2016+
);
2017+
}
2018+
2019+
@Test
2020+
public void genericClassStaticAttribute() {
2021+
testAssertOkLines(true,
2022+
"package test",
2023+
"class Box<T:>",
2024+
" static int count = 1",
2025+
"init",
2026+
" if Box<int>.count == 1 and Box<real>.count == 1",
2027+
" testSuccess()",
2028+
"endpackage"
2029+
);
2030+
}
2031+
19252032

19262033

19272034
}

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLib.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class StdLib {
2323
/**
2424
* version to use for the tests
2525
*/
26-
private final static String version = "6107c40e64fa646a016e8c446026f2f5cf3f2a1e";
26+
private final static String version = "e6463189f754b8794e59ba9d4ac1a91977c8aaac";
2727

2828
/**
2929
* flag so that initialization in only done once

0 commit comments

Comments
 (0)