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

5
import 'package:flutter/physics.dart';
6
import 'package:flutter_test/flutter_test.dart';
7

Ian Hickson's avatar
Ian Hickson committed
8 9 10 11 12 13 14
void main() {
  test('test_friction', () {
    expect(nearEqual(5.0, 6.0, 2.0), isTrue);
    expect(nearEqual(6.0, 5.0, 2.0), isTrue);
    expect(nearEqual(5.0, 6.0, 0.5), isFalse);
    expect(nearEqual(6.0, 5.0, 0.5), isFalse);
  });
15 16 17 18 19 20

  test('test_null', () {
    expect(nearEqual(5.0, null, 2.0), isFalse);
    expect(nearEqual(null, 5.0, 2.0), isFalse);
    expect(nearEqual(null, null, 2.0), isTrue);
  });
Ian Hickson's avatar
Ian Hickson committed
21
}