50 lines
1.6 KiB
Dart
50 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:smoke_cess_app/utils/timer_util.dart';
|
|
|
|
void main() {
|
|
test('FormatTime: Seconds', () {
|
|
String result = formatTime(1);
|
|
expect(result, '00:01');
|
|
});
|
|
test('FormatTime: Minutes', () {
|
|
String result = formatTime(61);
|
|
expect(result, '01:01');
|
|
});
|
|
test('FormatTime: Hours', () {
|
|
String result = formatTime(3661);
|
|
expect(result, '01:01:01');
|
|
});
|
|
test('FormatTime: Day', () {
|
|
String result = formatTime(90061);
|
|
expect(result, '1 Tag, 01:01:01');
|
|
});
|
|
test('FormatTime: Days', () {
|
|
String result = formatTime(176461);
|
|
expect(result, '2 Tage, 01:01:01');
|
|
});
|
|
test('FormatTime: Negativ Value', () {
|
|
String result = formatTime(-1);
|
|
expect(result, '00:00');
|
|
});
|
|
|
|
test('DurationBetween: 0', () {
|
|
TimeOfDay start = const TimeOfDay(hour: 12, minute: 0);
|
|
TimeOfDay end = const TimeOfDay(hour: 12, minute: 0);
|
|
TimeOfDay result = start.durationBetween(end);
|
|
expect(result, const TimeOfDay(hour: 0, minute: 0));
|
|
});
|
|
test('DurationBetween: 23h 59min', () {
|
|
TimeOfDay start = const TimeOfDay(hour: 0, minute: 0);
|
|
TimeOfDay end = const TimeOfDay(hour: 23, minute: 59);
|
|
TimeOfDay result = start.durationBetween(end);
|
|
expect(result, const TimeOfDay(hour: 23, minute: 59));
|
|
});
|
|
test('DurationBetween: 12h 34min', () {
|
|
TimeOfDay start = const TimeOfDay(hour: 2, minute: 12);
|
|
TimeOfDay end = const TimeOfDay(hour: 14, minute: 46);
|
|
TimeOfDay result = start.durationBetween(end);
|
|
expect(result, const TimeOfDay(hour: 12, minute: 34));
|
|
});
|
|
}
|