Finished poset implementation added to the standard library, starting on getting types added and sorting, etc
This commit is contained in:
4
tests/test_poset.expected_results
Normal file
4
tests/test_poset.expected_results
Normal file
@@ -0,0 +1,4 @@
|
||||
i depends on i+1
|
||||
10 9 8 7 6 5 4 3 2 1 0
|
||||
i depends on i-1
|
||||
-1 0 1 2 3 4 5 6 7 8 9
|
||||
28
tests/test_poset.krak
Normal file
28
tests/test_poset.krak
Normal file
@@ -0,0 +1,28 @@
|
||||
import io:*
|
||||
import poset:*
|
||||
|
||||
|
||||
|
||||
fun main():int {
|
||||
println("i depends on i+1")
|
||||
var int_poset = poset<int>()
|
||||
for (var i = 0; i < 10; i++;)
|
||||
int_poset.add_relationship(i, i+1)
|
||||
int_poset.get_sorted().for_each(fun(i: int) {
|
||||
print(i)
|
||||
print(" ")
|
||||
})
|
||||
println()
|
||||
|
||||
println("i depends on i-1")
|
||||
int_poset = poset<int>()
|
||||
for (var i = 0; i < 10; i++;)
|
||||
int_poset.add_relationship(i, i-1)
|
||||
int_poset.get_sorted().for_each(fun(i: int) {
|
||||
print(i)
|
||||
print(" ")
|
||||
})
|
||||
println()
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import to_import: simple_print, a, b
|
||||
|
||||
/*obj Something (ObjectTrait) {*/
|
||||
/*var member: int*/
|
||||
/*fun method():int {*/
|
||||
/*return 5*/
|
||||
/*}*/
|
||||
/*}*/
|
||||
obj Something (ObjectTrait) {
|
||||
var member: int
|
||||
fun method():int {
|
||||
return 5
|
||||
}
|
||||
}
|
||||
|
||||
/*fun some_function(): int return 0;*/
|
||||
/*fun some_other_function(in: bool): float {*/
|
||||
@@ -26,18 +26,19 @@ fun main(): int {
|
||||
/*simple_print(1337)*/
|
||||
/*if (1 + 2 && false) simple_print("its true!")*/
|
||||
/*else simple_print("its false!")*/
|
||||
var counter = 10
|
||||
counter--
|
||||
--counter
|
||||
while (counter) simple_print(counter--)
|
||||
simple_print("\n")
|
||||
counter = 8
|
||||
while (counter) {
|
||||
simple_print(--counter)
|
||||
}
|
||||
simple_print("\n")
|
||||
for (var j = 0; j < 10; j++;)
|
||||
simple_print(j)
|
||||
/*var counter = 10*/
|
||||
/*counter--*/
|
||||
/*--counter*/
|
||||
/*while (counter) simple_print(counter--)*/
|
||||
/*simple_print("\n")*/
|
||||
/*counter = 8*/
|
||||
/*while (counter) {*/
|
||||
/*simple_print(--counter)*/
|
||||
/*}*/
|
||||
/*simple_print("\n")*/
|
||||
/*for (var j = 0; j < 10; j++;)*/
|
||||
/*simple_print(j)*/
|
||||
var an_obj: Something
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user