diff options
author | Paweł Dybiec <pdybiec@stud.cs.uni.wroc.pl> | 2018-12-23 17:10:36 +0100 |
---|---|---|
committer | Paweł Dybiec <pdybiec@stud.cs.uni.wroc.pl> | 2018-12-23 17:10:36 +0100 |
commit | a8a49e5b1f968d4ae160052a35242efc7ea30e30 (patch) | |
tree | e05b1314df984e1c3ebea212e77df96d76844ec8 /tests/pracownia4/01_sort.xi | |
parent | Start of regalloc (diff) |
Update tests
Diffstat (limited to 'tests/pracownia4/01_sort.xi')
-rw-r--r-- | tests/pracownia4/01_sort.xi | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/pracownia4/01_sort.xi b/tests/pracownia4/01_sort.xi new file mode 100644 index 0000000..e875eaf --- /dev/null +++ b/tests/pracownia4/01_sort.xi @@ -0,0 +1,31 @@ +printString(x:int[]) + +sort(a: int[]) { + i:int = 0 + n:int = length(a) + while (i < n) { + j:int = i + while (j > 0) { + if (a[j-1] > a[j]) { + swap:int = a[j] + a[j] = a[j-1] + a[j-1] = swap + } + j = j-1 + } + i = i+1 + } +} + + +main():int +{ + x:int[] = "Wroclaw" + sort(x) + printString(x) + return 1 +} + +//@PRACOWNIA +//@out Waclorw +//@out Exit code: 1 \ No newline at end of file |