Project

General

Profile

Patch #14740 » RM_14740_display_hours_decimals_only_if_fractional_V2_tests.diff

the unit tests - Jérôme BATAILLE, 2014-06-13 19:09

View differences:

test/unit/lib/redmine/i18n_test.rb (copie de travail)
259 259
    end
260 260
    assert_equal str_fr, l(:general_lang_name)
261 261
  end
262

  
263
  def test_localize_hours_truncate_decimals_if_integer
264
    set_language_if_valid 'fr'
265

  
266
    assert_equal "121.50 heures", l_hours('121.49999')
267

  
268
    # Decimals rounded to 2 after the decimal point
269
    assert_equal "122.45 heures", l_hours('122.4521')
270

  
271
    # Rounded to upper value
272
    assert_equal "123.46 heures", l_hours('123.458')
273

  
274
    assert_equal "124 heures", l_hours('124.0')
275

  
276
    assert_equal "125 heures", l_hours('125.00')
277

  
278
    assert_equal "126 heures", l_hours('126.0000')
279

  
280
    # Far decimals disappear in the rounding
281
    assert_equal "455 heures", l_hours('455.00001')
282

  
283
    # Rounded to upper value
284
    assert_equal "456 heures", l_hours('455.999999')
285

  
286
    set_language_if_valid('en')
287
  end
288

  
289
  def test_localize_negative_hours
290
    set_language_if_valid 'fr'
291

  
292
    assert_equal "-1 heure", l_hours('-1.00001')
293
    assert_equal "-1.46 heure", l_hours('-1.456')
294
    assert_equal "-457 heures", l_hours('-457.00001')
295
    assert_equal "-459 heures", l_hours('-458.99999')
296

  
297
    set_language_if_valid('en')
298
  end
262 299
end
(4-4/4)