|
Last change
on this file since 7101 was 6871, checked in by simon04, 12 years ago |
|
Add unit test for AlphanumComparator
|
|
File size:
608 bytes
|
| Rev | Line | |
|---|
| [6871] | 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package org.openstreetmap.josm.tools
|
|---|
| 3 |
|
|---|
| 4 | class AlphanumComparatorTest extends GroovyTestCase {
|
|---|
| 5 |
|
|---|
| 6 | void testNumeric() {
|
|---|
| 7 | def lst = Arrays.asList("1", "20", "-1", "00999", "100")
|
|---|
| 8 | Collections.sort(lst, AlphanumComparator.getInstance())
|
|---|
| 9 | assert lst == Arrays.asList("-1", "1", "20", "100", "00999")
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | void testMixed() {
|
|---|
| 13 | def lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100")
|
|---|
| 14 | Collections.sort(lst, AlphanumComparator.getInstance())
|
|---|
| 15 | assert lst == Arrays.asList("a5", "a100", "a00999", "b1", "b20")
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.