source: josm/trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.groovy @ 7030

Last change on this file since 7030 was 6871, checked in by simon04, 6 years ago

Add unit test for AlphanumComparator

File size: 608 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools
3
4class 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.