Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion exercises/gigasecond/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Gigasecond

Calculate the moment when someone has lived for 10^9 seconds.
Given a moment, determine the moment that would be after a gigasecond
has passed.

A gigasecond is 10^9 (1,000,000,000) seconds.

Expand Down
1 change: 1 addition & 0 deletions exercises/gigasecond/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'gigasecond'
version: 2.0.0
environment:
sdk: '>=2.0.0 <3.0.0'
dev_dependencies:
Expand Down
82 changes: 42 additions & 40 deletions exercises/gigasecond/test/gigasecond_test.dart
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
import 'package:test/test.dart';
import 'package:gigasecond/gigasecond.dart';
import 'package:test/test.dart';

void main() {
group("Gigasecond", gigasecondTests);
}

void gigasecondTests() {
test("date only specification of time", () {
final DateTime birthDate = new DateTime.utc(2011, DateTime.april, 25);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2043, DateTime.january, 1, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: false);

test("second test for date only specification of time", () {
final DateTime birthDate = new DateTime.utc(1977, DateTime.june, 13);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2009, DateTime.february, 19, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test("third test for date only specification of time", () {
final DateTime birthDate = new DateTime.utc(1959, DateTime.july, 19);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(1991, DateTime.march, 27, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test("full time specified", () {
final DateTime birthDate = new DateTime.utc(2015, DateTime.january, 24, 22, 00, 00);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2046, DateTime.october, 2, 23, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test("full time with day roll-over", () {
final DateTime birthDate = new DateTime.utc(2015, DateTime.january, 24, 23, 59, 59);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2046, DateTime.october, 3, 01, 46, 39);

expect(result, equals(expectedDate));
}, skip: true);
group('Add one gigasecond to the input. ', () {
test('date only specification of time', () {
final DateTime birthDate = new DateTime.utc(2011, DateTime.april, 25);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2043, DateTime.january, 1, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: false);

test('second test for date only specification of time', () {
final DateTime birthDate = new DateTime.utc(1977, DateTime.june, 13);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2009, DateTime.february, 19, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test('third test for date only specification of time', () {
final DateTime birthDate = new DateTime.utc(1959, DateTime.july, 19);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(1991, DateTime.march, 27, 1, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test('full time specified', () {
final DateTime birthDate = new DateTime.utc(2015, DateTime.january, 24, 22, 00, 00);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2046, DateTime.october, 2, 23, 46, 40);

expect(result, equals(expectedDate));
}, skip: true);

test('full time with day roll-over', () {
final DateTime birthDate = new DateTime.utc(2015, DateTime.january, 24, 23, 59, 59);
final DateTime result = add(birthDate);
DateTime expectedDate = new DateTime.utc(2046, DateTime.october, 3, 01, 46, 39);

expect(result, equals(expectedDate));
}, skip: true);
});
}