nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: filter out readline on OSX
[nit.git]
/
tests
/
example_sorter.nit
diff --git
a/tests/example_sorter.nit
b/tests/example_sorter.nit
index
23da9ac
..
ae839ed
100644
(file)
--- a/
tests/example_sorter.nit
+++ b/
tests/example_sorter.nit
@@
-15,8
+15,9
@@
# limitations under the License.
# limitations under the License.
-class BackIntSorter
- super AbstractSorter[Int]
+class BackIntComparator
+ super Comparator
+ redef type COMPARED: Int
redef fun compare(a: Int, b: Int): Int
do
return b <=> a
redef fun compare(a: Int, b: Int): Int
do
return b <=> a
@@
-25,8
+26,9
@@
class BackIntSorter
init do end
end
init do end
end
-class DecimalSorter
- super AbstractSorter[Int]
+class DecimalComparator
+ super Comparator
+ redef type COMPARED: Int
redef fun compare(a: Int, b: Int): Int
do
return (a%10) <=> (b%10)
redef fun compare(a: Int, b: Int): Int
do
return (a%10) <=> (b%10)
@@
-51,11
+53,11
@@
end
var q = get_an_array(50)
print(q.join(" "))
var q = get_an_array(50)
print(q.join(" "))
-(new ComparableSorter[Int]).sort(q)
+(default_comparator).sort(q)
print(q.join(" "))
print(q.join(" "))
-(new DecimalSorter).sort(q)
+(new DecimalComparator).sort(q)
print(q.join(" "))
print(q.join(" "))
-(new BackIntSorter).sort(q)
+(new BackIntComparator).sort(q)
print(q.join(" "))
print(q.join(" "))
-(new DecimalSorter).sort(q)
+(new DecimalComparator).sort(q)
print(q.join(" "))
print(q.join(" "))