Adds a testsuite to Time API.

This commit is contained in:
zontreck 2024-05-23 17:25:14 -07:00
parent 6ba00044af
commit d4a6a3609e
2 changed files with 35 additions and 0 deletions

23
test/time_test.dart Normal file
View file

@ -0,0 +1,23 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:libac_flutter/utils/TimeUtils.dart';
void main() {
test("Parse time notation", () {
Time time = Time.fromNotation("4h9s");
expect(time.toString(), "4h9s");
expect(time.hours, 4);
expect(time.minutes, 0);
expect(time.seconds, 9);
});
test("Add time", () {
// Depends on first test working!
Time time = Time.fromNotation("4h9s");
time.add(Time(hours: 0, minutes: 80, seconds: 1));
expect(time.hours, 5);
expect(time.minutes, 20);
expect(time.seconds, 10);
});
}