Ignore:
Timestamp:
2020-03-10T23:08:20+01:00 (4 years ago)
Author:
Don-vip
Message:

add MapCSS conversion functions: to_boolean, to_byte, to_short, to_int, to_long, to_float, to_double

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java

    r15246 r16110  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56import static org.openstreetmap.josm.data.osm.OsmPrimitiveType.NODE;
    67
     
    8990        assertEquals(0, Functions.osm_timestamp(new EnvBuilder(NODE).build()));
    9091    }
     92
     93    /**
     94     * Unit test of {@code Functions#to_xxx}
     95     */
     96    @Test
     97    public void testParseFunctions() {
     98        assertTrue(Functions.to_boolean("true"));
     99        assertEquals(1, Functions.to_byte("1"));
     100        assertEquals(1, Functions.to_short("1"));
     101        assertEquals(1, Functions.to_int("1"));
     102        assertEquals(1L, Functions.to_long("1"));
     103        assertEquals(1f, Functions.to_float("1"), 1e-10);
     104        assertEquals(1d, Functions.to_double("1"), 1e-10);
     105    }
    91106}
Note: See TracChangeset for help on using the changeset viewer.