- Add VariableSpec class with magnitude field validation - Add Formula class supporting multiple input/output variables - Support d4rt_code as string or object with code field - Add comprehensive tests for parsing and serialization - Fix broken test import in pruebas_d4rt_test.dart Follows README.md format requirements exactly
43 lines
1.4 KiB
Dart
43 lines
1.4 KiB
Dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'utils.dart';
|
|
|
|
void main() {
|
|
test('floorAndCeilProduceExactSecondDateTime', () {
|
|
DateTime time = DateTime.fromMicrosecondsSinceEpoch(1001);
|
|
DateTime lower = floor(time);
|
|
DateTime upper = ceil(time);
|
|
expect(lower.millisecond, 0);
|
|
expect(upper.millisecond, 0);
|
|
expect(lower.microsecond, 0);
|
|
expect(upper.microsecond, 0);
|
|
});
|
|
|
|
test('floorAndCeilWorkWithNow', () {
|
|
DateTime time = DateTime.now();
|
|
int lower = time.difference(floor(time)).inMicroseconds;
|
|
int upper = ceil(time).difference(time).inMicroseconds;
|
|
expect(lower, lessThan(1000000));
|
|
expect(upper, lessThanOrEqualTo(1000000));
|
|
});
|
|
|
|
test('floorAndCeilWorkWithExactSecondDateTime', () {
|
|
DateTime time = DateTime.parse('1999-12-31 23:59:59');
|
|
DateTime lower = floor(time);
|
|
DateTime upper = ceil(time);
|
|
expect(lower, time);
|
|
expect(upper, time);
|
|
});
|
|
|
|
test('floorAndCeilWorkWithInexactSecondDateTime', () {
|
|
DateTime time = DateTime.parse('1999-12-31 23:59:59.500');
|
|
DateTime lower = floor(time);
|
|
DateTime upper = ceil(time);
|
|
Duration difference = upper.difference(lower);
|
|
expect(difference.inMicroseconds, 1000000);
|
|
});
|
|
}
|