• Home
  • About
  • Ekko
  • C.V.
  • Blog
  • Archive
  • Contact
  • RSS
  • Menu

Alex Strick van Linschoten

  • Home
  • About
  • Ekko
  • C.V.
  • Blog
  • Archive
  • Contact
  • RSS
ScreenShot 2018-06-17 at 11.34.18.png

Figuring out the Go testing ecosystem

June 17, 2018 in Coding

I've been trying to figure out a way to work my way into increasingly complex Go explorations. I thought I'd start at the most simple and expand from there.

I thought I'd start off with a simple fmt.Println command. I loaded up GoLand only to find that I had 2 days left in my trial for the software. Open-source software is much more my scene, so I downloaded Atom and continued my coding there.

At first I wrote a basic draft of my code. I couldn't figure out how to test it, however, perhaps because my function wasn't returning anything, so I switched gears. No point getting distracted by these details. I wrote a function that definetely did return something: the sum of two integers.

[My code is all available here.]

I wrote examples for all my functions using the ExampleFunctionname syntax as described in the golang spec / documentation but I couldn't seem to get that to work. I'll have to return to that in due course.

Benchmarking worked fine. Go's benchmarking tools figure out how many times they need to run a particular function in order to properly test it. In my case, each function ran two billion times for an average of 0.29 and 0.3 nanoseconds per iteration. Pretty fast! I have no baseline for knowing how fast that is, but it seems fast to me. Of course, the function isn't doing anything particularly taxing.

My next task will be to figure out table testing so that instead of my current setup where I have the values for each test written out manually, and just one test per function, I want to have many different sets of values to test.

Tags: golang, testing, coding
Prev / Next

Mailing List

Popular Posts

Featured
Coding, Productivity
Solid Study Habits for Coders
Coding, Productivity
Coding, Productivity
General, Movement
Pain: A Love Story
General, Movement
General, Movement
Useful Tools, Productivity, Tech, Language, Coding
Introducing CoachBot: Your Personal Language Taskmaster
Useful Tools, Productivity, Tech, Language, Coding
Useful Tools, Productivity, Tech, Language, Coding
Books, Jordan, Language
Everything You Need to Study Jordanian Arabic
Books, Jordan, Language
Books, Jordan, Language
Incremental Elephant, Language, Books
The Two Books Every Intermediate Arabic Student Needs to Read
Incremental Elephant, Language, Books
Incremental Elephant, Language, Books
Books, Productivity
Fundamentals Versus Hacks
Books, Productivity
Books, Productivity
Productivity, PhD
PhD Tools: The Secret to Finishing Your PhD
Productivity, PhD
Productivity, PhD
Jordan, Climbing
Existential Battles: Climbing in Amman
Jordan, Climbing
Jordan, Climbing
Afghanistan, Books, First Draft Publishing
Reading the Afghan Taliban: 67 Sources You Should Be Studying
Afghanistan, Books, First Draft Publishing
Afghanistan, Books, First Draft Publishing
Books, Journalism, Pakistan
North Waziristan: A Reading List
Books, Journalism, Pakistan
Books, Journalism, Pakistan

Recent Posts

Blog
First stitches: on learning to knit
about 5 months ago
Language Learning Crash Course: from slightly more than zero to slightly less than advanced
about a year ago
All the things I wish I knew about studying at school
about a year ago
Automating social media posting for my new blogposts
about a year ago
Vermeer at the Rijksmuseum
about 2 years ago