double_precision_test.dart 634 Bytes
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
6
import 'package:flutter_test/flutter_test.dart';
7 8 9 10 11 12 13 14 15 16 17 18 19 20

void main() {
  test('debugFormatDouble formats doubles', () {
    expect(debugFormatDouble(1), '1.0');
    expect(debugFormatDouble(1.1), '1.1');
    expect(debugFormatDouble(null), 'null');
  });

  test('debugDoublePrecision can control double precision', () {
    debugDoublePrecision = 3;
    expect(debugFormatDouble(1), '1.00');
    debugDoublePrecision = null;
  });
}