mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
61 lines
2.2 KiB
Dart
61 lines
2.2 KiB
Dart
import 'package:nc_photos/num_extension.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group("NumExtension", () {
|
|
group("inRange", () {
|
|
test("[x, y)", () {
|
|
expect(10.inRange(0, 20, isBegInclusive: true, isEndInclusive: false),
|
|
true);
|
|
expect(0.inRange(0, 20, isBegInclusive: true, isEndInclusive: false),
|
|
true);
|
|
expect((-1).inRange(0, 20, isBegInclusive: true, isEndInclusive: false),
|
|
false);
|
|
expect(20.inRange(0, 20, isBegInclusive: true, isEndInclusive: false),
|
|
false);
|
|
expect(21.inRange(0, 20, isBegInclusive: true, isEndInclusive: false),
|
|
false);
|
|
});
|
|
|
|
test("[x, y]", () {
|
|
expect(10.inRange(0, 20, isBegInclusive: true, isEndInclusive: true),
|
|
true);
|
|
expect(
|
|
0.inRange(0, 20, isBegInclusive: true, isEndInclusive: true), true);
|
|
expect((-1).inRange(0, 20, isBegInclusive: true, isEndInclusive: true),
|
|
false);
|
|
expect(20.inRange(0, 20, isBegInclusive: true, isEndInclusive: true),
|
|
true);
|
|
expect(21.inRange(0, 20, isBegInclusive: true, isEndInclusive: true),
|
|
false);
|
|
});
|
|
|
|
test("(x, y)", () {
|
|
expect(10.inRange(0, 20, isBegInclusive: false, isEndInclusive: false),
|
|
true);
|
|
expect(0.inRange(0, 20, isBegInclusive: false, isEndInclusive: false),
|
|
false);
|
|
expect(
|
|
(-1).inRange(0, 20, isBegInclusive: false, isEndInclusive: false),
|
|
false);
|
|
expect(20.inRange(0, 20, isBegInclusive: false, isEndInclusive: false),
|
|
false);
|
|
expect(21.inRange(0, 20, isBegInclusive: false, isEndInclusive: false),
|
|
false);
|
|
});
|
|
|
|
test("(x, y]", () {
|
|
expect(10.inRange(0, 20, isBegInclusive: false, isEndInclusive: true),
|
|
true);
|
|
expect(0.inRange(0, 20, isBegInclusive: false, isEndInclusive: true),
|
|
false);
|
|
expect((-1).inRange(0, 20, isBegInclusive: false, isEndInclusive: true),
|
|
false);
|
|
expect(20.inRange(0, 20, isBegInclusive: false, isEndInclusive: true),
|
|
true);
|
|
expect(21.inRange(0, 20, isBegInclusive: false, isEndInclusive: true),
|
|
false);
|
|
});
|
|
});
|
|
});
|
|
}
|