Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import '/app/core/bongabdo/bongabdo.dart';
- import 'package:test/test.dart';
- void main() {
- Map<DateTime, String> testCaseMap = Map();
- prepareTestCases(testCaseMap);
- final Bongabdo bongabdo = Bongabdo();
- testCaseMap.forEach((dateTime, bongabdoDate) {
- test('Bongabdo Unit Test', () {
- bongabdo.set(dateTime: dateTime);
- expect(
- "${bongabdo.day} ${bongabdo.month} ${bongabdo.year} ${bongabdo.season}",
- bongabdoDate,
- );
- });
- });
- }
- void prepareTestCases(Map<DateTime, String> testCaseMap) {
- // Bangladesh / Leap Year / Ordinary day test
- testCaseMap[DateTime(2020, 1, 1)] = '17 8 1426 4';
- testCaseMap[DateTime(2020, 4, 13)] = '30 11 1426 5';
- testCaseMap[DateTime(2020, 4, 14)] = '1 0 1427 0';
- testCaseMap[DateTime(2020, 4, 30)] = '17 0 1427 0';
- testCaseMap[DateTime(2028, 4, 1)] = '18 11 1434 5';
- testCaseMap[DateTime(2028, 4, 13)] = '30 11 1434 5';
- testCaseMap[DateTime(2028, 4, 14)] = '1 0 1435 0';
- testCaseMap[DateTime(2028, 9, 30)] = '15 5 1435 2';
- testCaseMap[DateTime(2028, 12, 1)] = '16 7 1435 3';
- testCaseMap[DateTime(2028, 12, 31)] = '16 8 1435 4';
- // Bangladesh / Non-Leap Year / Ordinary day test
- testCaseMap[DateTime(2021, 1, 1)] = '17 8 1427 4';
- testCaseMap[DateTime(2021, 1, 31)] = '17 9 1427 4';
- testCaseMap[DateTime(2021, 2, 18)] = '5 10 1427 5';
- testCaseMap[DateTime(2021, 4, 13)] = '30 11 1427 5';
- testCaseMap[DateTime(2021, 4, 14)] = '1 0 1428 0';
- testCaseMap[DateTime(2100, 3, 14)] = '29 10 1506 5';
- testCaseMap[DateTime(2100, 3, 15)] = '1 11 1506 5';
- testCaseMap[DateTime(2100, 4, 13)] = '30 11 1506 5';
- // Bangladesh / Leap Year / Special day test
- testCaseMap[DateTime(2020, 2, 21)] = '8 10 1426 5';
- testCaseMap[DateTime(2020, 3, 26)] = '12 11 1426 5';
- testCaseMap[DateTime(2020, 5, 8)] = '25 0 1427 0';
- testCaseMap[DateTime(2020, 5, 25)] = '11 1 1427 0';
- testCaseMap[DateTime(2020, 12, 16)] = '1 8 1427 4';
- // Bangladesh / Non-Leap Year / Special day test
- testCaseMap[DateTime(2021, 2, 21)] = '8 10 1427 5';
- testCaseMap[DateTime(2021, 3, 26)] = '12 11 1427 5';
- testCaseMap[DateTime(2021, 5, 8)] = '25 0 1428 0';
- testCaseMap[DateTime(2021, 5, 25)] = '11 1 1428 0';
- testCaseMap[DateTime(2021, 12, 16)] = '1 8 1428 4';
- }
Add Comment
Please, Sign In to add comment