rename test to about

This commit is contained in:
Steven Degutis
2012-03-16 08:34:26 -05:00
parent 13255197df
commit 996cbb5189
15 changed files with 31 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
package go_koans
func testAllocation() {
func aboutAllocation() {
a := new(int)
*a = 3
assert(*a == __int__) // new() creates a pointer to the given type, like malloc() in C

View File

@@ -1,6 +1,6 @@
package go_koans
func testAnonymousFunctions() {
func aboutAnonymousFunctions() {
{
i := 1
increment := func() {

View File

@@ -1,6 +1,6 @@
package go_koans
func testArrays() {
func aboutArrays() {
fruits := [4]string{"apple", "orange", "mango"}
assert(fruits[0] == __string__) // indexes begin at 0

View File

@@ -2,7 +2,7 @@ package go_koans
import "fmt"
func testControlFlow() {
func aboutControlFlow() {
{
a, b, c := 1, 2, 3
assert(a == __int__) // multiple assignment

View File

@@ -1,6 +1,6 @@
package go_koans
func testEnumeration() {
func aboutEnumeration() {
{
var concatenated string
var total int

View File

@@ -3,7 +3,7 @@ package go_koans
import "io/ioutil"
import "strings"
func testFiles() {
func aboutFiles() {
filename := "about_files.go"
contents, _ := ioutil.ReadFile(filename)
lines := strings.Split(string(contents), "\n")

View File

@@ -1,6 +1,6 @@
package go_koans
func testInterfaces() {
func aboutInterfaces() {
mspaint := &program{3} // mspaint is a kind of *program, which is a valid 'runner'
runOnce(mspaint) // runOnce takes an abstract 'runner' type

View File

@@ -1,6 +1,6 @@
package go_koans
func testMaps() {
func aboutMaps() {
ages := map[string]int{
"bob": 10,
"joe": 20,

View File

@@ -1,6 +1,6 @@
package go_koans
func testNumbers() {
func aboutNumbers() {
assert(__bool__ == true) // what is truth?
assert(__bool__ != false) // in it there is nothing false

View File

@@ -1,6 +1,6 @@
package go_koans
func testPointers() {
func aboutPointers() {
{
a := 3
b := a // 'b' is a copy of 'a' (all assignments are copy-operations)

View File

@@ -1,6 +1,6 @@
package go_koans
func testSlices() {
func aboutSlices() {
fruits := []string{"apple", "orange", "mango"}
assert(fruits[0] == __string__) // slices seem like arrays

View File

@@ -2,7 +2,7 @@ package go_koans
import "fmt"
func testStrings() {
func aboutStrings() {
assert("a" + __string__ == "abc") // string concatenation need not be difficult
assert(len("abc") == __int__) // and bounds are thoroughly checked

View File

@@ -1,6 +1,6 @@
package go_koans
func testStructs() {
func aboutStructs() {
var bob struct {
name string
age int

View File

@@ -6,7 +6,7 @@ func concatNames(sep string, names ...string) string {
return strings.Join(names, sep) // variadic parameters are really just slices
}
func testVariadicFunctions() {
func aboutVariadicFunctions() {
{
str := concatNames(" ", "bob", "billy", "fred")
assert(str == __string__) // several values can be passed to variadic parameters

View File

@@ -17,25 +17,25 @@ var __bool__ bool = false // ugh
var __float32__ float32 = -1.0
func TestKoans(t *testing.T) {
//testNumbers()
//testStrings()
//testArrays()
//testSlices()
//testControlFlow()
//testEnumeration()
//testAnonymousFunctions()
//testVariadicFunctions()
//testFiles()
//testInterfaces()
//testMaps()
//testPointers()
//testStructs()
testAllocation()
//aboutNumbers()
//aboutStrings()
//aboutArrays()
//aboutSlices()
//aboutControlFlow()
//aboutEnumeration()
//aboutAnonymousFunctions()
//aboutVariadicFunctions()
//aboutFiles()
//aboutInterfaces()
//aboutMaps()
//aboutPointers()
//aboutStructs()
aboutAllocation()
// TODO: ie, gameplan
//testGoroutines()
//testChannels()
//testPanics()
//aboutGoroutines()
//aboutChannels()
//aboutPanics()
fmt.Printf("\n%c[32;1mYou won life. Good job.\n\n", 27)
}