Skip to content

Instantly share code, notes, and snippets.

View adilw3nomad's full-sized avatar

adilw3nomad adilw3nomad

  • Somewhere
View GitHub Profile
go
package main
import “testing”
func TestCheckCorrectAnswer(t *testing.T) {
got := CheckAnswer(“3”, “3”)
if got != “Correct! Well done” {
t.Errorf(“CheckCorrectAnswer = %v; want ‘Correct! Well Done’”, got)
}
go
func TestCheckAnswer(t *testing.T) {
gotCorrect := CheckAnswer(“3”, “3”)
if gotCorrect != “Correct! Well done” {
t.Errorf(“CheckAnswer = %v; want ‘Correct! Well Done’”, gotCorrect)
}
gotIncorrect := CheckAnswer(“3”, “2”)
if gotIncorrect != “WRONG! Answer is: 2” {
t.Errorf(“CheckAnswer = %v; want ‘WRONG! Answer is: 2’”, gotIncorrect)
}
go
func TestCheckAnswer(t *testing.T) {
got := CheckAnswer(“3”, “3”)
if got != true {
t.Errorf(“CheckAnswer = %v; want true”, got)
}
}
go
package main
import “testing”
func TestCompareAnswer(t *testing.T) {
got := CompareAnswer(“3”, “3”)
if got != true {
t.Errorf(“CompareAnswer = %v; want true”, got)
}
go
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
"strings"
package main

import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
"strings"

29 May 2019 at 05:20

I started my morning with some cowboy coffee; which is coffee brewed in a saucepan, since I seem to have misplaced my aero press, as I listened to Go for beginners, and discovered Gophercises, a set of coding exercises in Go aimed at people who’ve done a few tutorials but have kinda lost steam. I felt like that described me, so I’ve decided to tackle these exercises while journalling my progress and learning in this blog.

/I have a peculiar writing style because I write in tandem with coding, so there’s a lot of tense switching, so apologies in advance. All comments and criticisms are encouraged, no matter how harsh or abrasive, as long as they are constructive!/

I’m going to tackle the first challenge, GitHub - gophercises/quiz: Ex 1 - Run timed quizzes via the command line.

So the first thing I need to do is make a new go pr