More test cases

This commit is contained in:
Ming Ming 2021-04-20 01:39:09 +08:00
parent 990de5bc7c
commit 668079474b
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,13 @@
import 'package:test/test.dart';
import 'package:nc_photos/double_extension.dart';
void main() {
group("DoubleExtension", () {
test("toStringAsFixedTruncated", () {
expect(1.23456.toStringAsFixedTruncated(4), "1.2346");
expect(1.23001.toStringAsFixedTruncated(4), "1.23");
expect(1.23.toStringAsFixedTruncated(4), "1.23");
expect(1.0.toStringAsFixedTruncated(4), "1");
});
});
}

View file

@ -0,0 +1,18 @@
import 'package:test/test.dart';
import 'package:nc_photos/string_extension.dart';
void main() {
group("StringExtension", () {
test("trimLeftAny", () {
expect(".,.123.,.321.,.".trimLeftAny(".,"), "123.,.321.,.");
});
test("trimRightAny", () {
expect(".,.123.,.321.,.".trimRightAny(".,"), ".,.123.,.321");
});
test("trimAny", () {
expect(".,.123.,.321.,.".trimAny(".,"), "123.,.321");
});
});
}