OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * Test fixture for the MeasurementSystem. |
| 7 * @constructor |
| 8 * @extends {testing.Test} |
| 9 */ |
| 10 function MeasurementSystemUnitTest() { |
| 11 testing.Test.call(this); |
| 12 } |
| 13 |
| 14 MeasurementSystemUnitTest.prototype = { |
| 15 __proto__: testing.Test.prototype, |
| 16 |
| 17 extraLibraries: [ |
| 18 '../../shared/js/cr.js', |
| 19 '../print_preview_utils.js', |
| 20 'measurement_system.js' |
| 21 ] |
| 22 }; |
| 23 |
| 24 TEST_F('MeasurementSystemUnitTest', 'parseNumberFormat', function() { |
| 25 assertTrue(areArraysEqual( |
| 26 ['.', ','], |
| 27 print_preview.MeasurementSystem.parseNumberFormat('123.456,78'))); |
| 28 assertTrue(areArraysEqual( |
| 29 ['.', '.'], |
| 30 print_preview.MeasurementSystem.parseNumberFormat('123.456.78'))); |
| 31 assertTrue(areArraysEqual( |
| 32 [',', '.'], |
| 33 print_preview.MeasurementSystem.parseNumberFormat('123,456.78'))); |
| 34 assertTrue(areArraysEqual( |
| 35 [',', ','], |
| 36 print_preview.MeasurementSystem.parseNumberFormat('123,456,78'))); |
| 37 assertTrue(areArraysEqual( |
| 38 [' ', ','], |
| 39 print_preview.MeasurementSystem.parseNumberFormat('123 456,78'))); |
| 40 assertTrue(areArraysEqual( |
| 41 [' ', '.'], |
| 42 print_preview.MeasurementSystem.parseNumberFormat('123 456.78'))); |
| 43 assertTrue(areArraysEqual( |
| 44 [' ', ' '], |
| 45 print_preview.MeasurementSystem.parseNumberFormat('123 456 78'))); |
| 46 assertTrue(areArraysEqual( |
| 47 ['', ''], |
| 48 print_preview.MeasurementSystem.parseNumberFormat('123'))); |
| 49 |
| 50 assertTrue(areArraysEqual( |
| 51 [',', '.'], |
| 52 print_preview.MeasurementSystem.parseNumberFormat('abcdef'))); |
| 53 assertTrue(areArraysEqual( |
| 54 [',', '.'], |
| 55 print_preview.MeasurementSystem.parseNumberFormat(null))); |
| 56 assertTrue(areArraysEqual( |
| 57 [',', '.'], |
| 58 print_preview.MeasurementSystem.parseNumberFormat(undefined))); |
| 59 assertTrue(areArraysEqual( |
| 60 [',', '.'], |
| 61 print_preview.MeasurementSystem.parseNumberFormat(''))); |
| 62 assertTrue(areArraysEqual( |
| 63 [',', '.'], |
| 64 print_preview.MeasurementSystem.parseNumberFormat('1'))); |
| 65 assertTrue(areArraysEqual( |
| 66 [',', '.'], |
| 67 print_preview.MeasurementSystem.parseNumberFormat('12'))); |
| 68 }); |
OLD | NEW |