added some tests for Months class
This commit is contained in:
parent
771c411723
commit
27f99d9866
1 changed files with 121 additions and 45 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'package:ohthatsa/util/Months.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:ohthatsa/util/DayCalculator.dart';
|
||||
|
||||
|
@ -16,7 +17,7 @@ void main() {
|
|||
expect(DayCalculator.getYearValue(2132), equals(5));
|
||||
});
|
||||
});
|
||||
group("DayCalculator getMonthValue()", () {
|
||||
group("DayCalculator getMonthValue() raw int", () {
|
||||
test("January", () {
|
||||
expect(DayCalculator.getMonthValue(0), equals(0));
|
||||
});
|
||||
|
@ -54,6 +55,44 @@ void main() {
|
|||
expect(DayCalculator.getMonthValue(11), equals(5));
|
||||
});
|
||||
});
|
||||
group("DayCalculator getMonthValue() Month.i", () {
|
||||
test("January", () {
|
||||
expect(DayCalculator.getMonthValue(Months.january.i), equals(0));
|
||||
});
|
||||
test("February", () {
|
||||
expect(DayCalculator.getMonthValue(Months.february.i), equals(3));
|
||||
});
|
||||
test("March", () {
|
||||
expect(DayCalculator.getMonthValue(Months.march.i), equals(3));
|
||||
});
|
||||
test("April", () {
|
||||
expect(DayCalculator.getMonthValue(Months.april.i), equals(6));
|
||||
});
|
||||
test("May", () {
|
||||
expect(DayCalculator.getMonthValue(Months.may.i), equals(1));
|
||||
});
|
||||
test("June", () {
|
||||
expect(DayCalculator.getMonthValue(Months.june.i), equals(4));
|
||||
});
|
||||
test("July", () {
|
||||
expect(DayCalculator.getMonthValue(Months.july.i), equals(6));
|
||||
});
|
||||
test("August", () {
|
||||
expect(DayCalculator.getMonthValue(Months.august.i), equals(2));
|
||||
});
|
||||
test("September", () {
|
||||
expect(DayCalculator.getMonthValue(Months.september.i), equals(5));
|
||||
});
|
||||
test("October", () {
|
||||
expect(DayCalculator.getMonthValue(Months.october.i), equals(0));
|
||||
});
|
||||
test("November", () {
|
||||
expect(DayCalculator.getMonthValue(Months.november.i), equals(3));
|
||||
});
|
||||
test("December", () {
|
||||
expect(DayCalculator.getMonthValue(Months.december.i), equals(5));
|
||||
});
|
||||
});
|
||||
group("DayCalculator getMonthValueByString()", () {
|
||||
test("January", () {
|
||||
expect(DayCalculator.getMonthValueByString("January"), equals(0));
|
||||
|
@ -92,6 +131,44 @@ void main() {
|
|||
expect(DayCalculator.getMonthValueByString("December"), equals(5));
|
||||
});
|
||||
});
|
||||
group("DayCalculator getMonthValueByString()", () {
|
||||
test("January", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.january.string), equals(0));
|
||||
});
|
||||
test("February", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.february.string), equals(3));
|
||||
});
|
||||
test("March", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.march.string), equals(3));
|
||||
});
|
||||
test("April", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.april.string), equals(6));
|
||||
});
|
||||
test("May", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.may.string), equals(1));
|
||||
});
|
||||
test("June", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.june.string), equals(4));
|
||||
});
|
||||
test("July", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.july.string), equals(6));
|
||||
});
|
||||
test("August", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.august.string), equals(2));
|
||||
});
|
||||
test("September", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.september.string), equals(5));
|
||||
});
|
||||
test("October", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.october.string), equals(0));
|
||||
});
|
||||
test("November", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.november.string), equals(3));
|
||||
});
|
||||
test("December", () {
|
||||
expect(DayCalculator.getMonthValueByString(Months.december.string), equals(5));
|
||||
});
|
||||
});
|
||||
group("DayCalculator getCenturyValue()", () {
|
||||
group("1700s", () {
|
||||
test("1700", () {
|
||||
|
@ -170,7 +247,6 @@ void main() {
|
|||
expect(DayCalculator.getCenturyValue(23049), equals(0));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
group("DayCalculator isLeapYear()", () {
|
||||
test("1800", () {
|
||||
|
|
Loading…
Add table
Reference in a new issue