You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"README.md": "# Gigasecond\n\nWrite a program that will calculate the date that someone turned or will celebrate their 1 Gs anniversary.\n\nA gigasecond is one billion (10**9) seconds.\n\n\n## Source\n\nChapter 9 in Chris Pine's online Learn to Program tutorial. [view source](http://pine.fm/LearnToProgram/?Chapter=09)\n",
6
+
"cases_test.go": "package gigasecond\n\n// Source: exercism/x-common\n// Commit: f362340 Merge pull request #36 from soniakeys/gigasecond-test-data\n\n// Add one gigasecond to the input.\nvar addCases = []struct {\n\tin string\n\twant string\n}{\n\t{\n\t\t\"2011-04-25\",\n\t\t\"2043-01-01T01:46:40\",\n\t},\n\t{\n\t\t\"1977-06-13\",\n\t\t\"2009-02-19T01:46:40\",\n\t},\n\t{\n\t\t\"1959-07-19\",\n\t\t\"1991-03-27T01:46:40\",\n\t},\n}\n",
7
+
"gigasecond_test.go": "package gigasecond\n\n// Write a function AddGigasecond that works with time.Time.\n// Also define a variable Birthday set to your (or someone else's) birthday.\n// Run go test -v to see your gigasecond anniversary.\n\nimport (\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n)\n\nconst testVersion = 1\n\n// Retired testVersions\n// (none) 98807b314216ff27492378a00df60410cc971d32\n\n// date formats used in test data\nconst (\n\tfmtD = \"2006-01-02\"\n\tfmtDT = \"2006-01-02T15:04:05\"\n)\n\nfunc TestAddGigasecond(t *testing.T) {\n\tif TestVersion != testVersion {\n\t\tt.Fatalf(\"Found TestVersion = %v, want %v.\", TestVersion, testVersion)\n\t}\n\tfor _, tc := range addCases {\n\t\tin := parse(tc.in, fmtD, t)\n\t\twant := parse(tc.want, fmtDT, t)\n\t\tgot := AddGigasecond(in)\n\t\tif !got.Equal(want) {\n\t\t\tt.Fatalf(`AddGigasecond(%s)\n = %s\nwant %s`, in, got, want)\n\t\t}\n\t}\n\tt.Log(\"Tested\", len(addCases), \"cases.\")\n}\n\nfunc TestYourAnniversary(t *testing.T) {\n\tt.Logf(`\nYour birthday: %s\nYour gigasecond anniversary: %s`, Birthday, AddGigasecond(Birthday))\n}\n\nfunc parse(s string, f string, t *testing.T) time.Time {\n\ttt, err := time.Parse(f, s)\n\tif err != nil {\n\t\t// can't run tests if input won't parse. if this seems to be a\n\t\t// development or ci environment, raise an error. if this condition\n\t\t// makes it to the solver though, ask for a bug report.\n\t\t_, statErr := os.Stat(\"example_gen.go\")\n\t\tif statErr == nil || os.Getenv(\"TRAVIS_GO_VERSION\") > \"\" {\n\t\t\tt.Fatal(err)\n\t\t} else {\n\t\t\tt.Log(err)\n\t\t\tt.Skip(\"(Not your problem. \" +\n\t\t\t\t\"please file issue at https://github.com/exercism/xgo.)\")\n\t\t}\n\t}\n\treturn tt\n}\n\nfunc BenchmarkAddGigasecond(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tAddGigasecond(time.Time{})\n\t}\n}\n"
8
+
},
9
+
"fresh": false,
10
+
"id": "go/gigasecond",
11
+
"language": "go",
12
+
"name": "Gigasecond",
13
+
"slug": "gigasecond",
14
+
"track_id": "go"
15
+
},
16
+
{
17
+
"files": {
18
+
"README.md": "# Leap\n\nWrite a program that will take a year and report if it is a leap year.\n\nThe tricky thing here is that a leap year occurs:\n\n```plain\non every year that is evenly divisible by 4\n except every year that is evenly divisible by 100\n unless the year is also evenly divisible by 400\n```\n\nFor example, 1997 is not a leap year, but 1996 is. 1900 is not a leap\nyear, but 2000 is.\n\nIf your language provides a method in the standard library that does\nthis look-up, pretend it doesn't exist and implement it yourself.\n\n## Notes\n\nFor a delightful, four minute explanation of the whole leap year\nphenomenon, go watch [this youtube video][video].\n\n[video]: http://www.youtube.com/watch?v=xX96xng7sAE\n\n\n## Source\n\nJavaRanch Cattle Drive, exercise 3 [view source](http://www.javaranch.com/leap.jsp)\n",
"README.md": "# Raindrops\n\nWrite a program that converts a number to a string, the contents of which depends on the number's prime factors.\n\n- If the number contains 3 as a prime factor, output 'Pling'.\n- If the number contains 5 as a prime factor, output 'Plang'.\n- If the number contains 7 as a prime factor, output 'Plong'.\n- If the number does not contain 3, 5, or 7 as a prime factor,\n just pass the number's digits straight through.\n\n## Examples\n\n- 28's prime-factorization is 2, 2, 7.\n - In raindrop-speak, this would be a simple \"Plong\".\n- 1755 prime-factorization is 3, 3, 3, 5, 13.\n - In raindrop-speak, this would be a \"PlingPlang\".\n- The prime factors of 34 are 2 and 17.\n - Raindrop-speak doesn't know what to make of that,\n so it just goes with the straightforward \"34\".\n\n\n## Source\n\nA variation on a famous interview question intended to weed out potential candidates. [view source](http://jumpstartlab.com)\n",
31
+
"raindrops_test.go": "package raindrops\n\nimport \"testing\"\n\nvar tests = []struct {\n\tinput int\n\texpected string\n}{\n\t{1, \"1\"},\n\t{3, \"Pling\"},\n\t{5, \"Plang\"},\n\t{7, \"Plong\"},\n\t{6, \"Pling\"},\n\t{9, \"Pling\"},\n\t{10, \"Plang\"},\n\t{14, \"Plong\"},\n\t{15, \"PlingPlang\"},\n\t{21, \"PlingPlong\"},\n\t{25, \"Plang\"},\n\t{35, \"PlangPlong\"},\n\t{49, \"Plong\"},\n\t{52, \"52\"},\n\t{105, \"PlingPlangPlong\"},\n\t{12121, \"12121\"},\n}\n\nfunc TestConvert(t *testing.T) {\n\tfor _, test := range tests {\n\t\tif actual := Convert(test.input); actual != test.expected {\n\t\t\tt.Errorf(\"Convert(%d) = %q, expected %q.\",\n\t\t\t\ttest.input, actual, test.expected)\n\t\t}\n\t}\n}\n\nfunc BenchmarkConvert(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tfor _, test := range tests {\n\t\t\tConvert(test.input)\n\t\t}\n\t}\n}\n"
0 commit comments