### Question:
WXUtils { public static float getFloat(Object value) { return getFloat(value, Float.NaN); }  static boolean isUiThread(); static boolean isUndefined(float value); static float getFloat(Object value); static Float getFloat(Object value, @Nullable Float df); static float fastGetFloat(String raw, int precision); static float fastGetFloat(String raw); static int getInt(Object value); static Integer getInteger(@Nullable Object value, @Nullable Integer df); @Deprecated static long getLong(Object value); @Deprecated static double getDouble(Object value); static boolean isTabletDevice(); static Boolean getBoolean(@Nullable Object value, @Nullable Boolean df); static long getAvailMemory(Context context); static String getString(@Nullable Object value,@Nullable String df); static int parseUnitOrPercent(String raw, int unit); static final char PERCENT; }### Answer:
@Test public void testGetFloat() throws Exception { float test_float = WXUtils.getFloat("12324.9px"); assertEquals(12324.9, test_float, 0.01); assertEquals(WXUtils.fastGetFloat("1.2345",2), 1.23f); }
@Test public void testGetFloatWX() throws Exception { Float test_float = WXUtils.getFloat("100wx"); Float want = 100 * TEST_DENSITY * TEST_VIEW_PORT / TEST_SCREEN_WIDTH; assertEquals(test_float, want , 0.01); test_float = WXUtils.getFloat("100px"); want = 100F; assertEquals(test_float, want); test_float = WXUtils.getFloat("100.2"); want = 100.2F; assertEquals(test_float, want); test_float = WXUtils.getFloat(100.2F); want = 100.2F; assertEquals(test_float, want, 0.0001); test_float = WXUtils.getFloat(100.2D); want = 100.2F; assertEquals(test_float, want, 0.0001); test_float = WXUtils.getFloat("NaN"); want = Float.NaN; assertEquals(test_float, want); }