
Your Job Is To Make The Tests Pass!
This is a tool for assessing or practicing beginner level programming in Golang. It is inspired by Rebecca Murphey's js-assessment
A while back I tried out Murphey's js-assessment and found it to be a valuable tool for refreshing my javascript capability when I had not written any JavaScript for a few months. I figured a similar tool for Go might be useful for the same reason.
This tool leads the user through a series of Go implementation exercises from easy to medium. It's not meant to be a leetcode challenge. The point is to exercise your skill with some basic syntax and semantics of Go. Most of the tests and implementations are straightforward. A few are harder, require a bit of algorithm knowledge or the ability to look up a solution. If you have gone through the official golang tutorial you will know enough to make most of the tests pass. For the rest go ahead and look up a solution if you need to. Feel free to use go standard libraries. No need to reinvent the wheel.
This tool relies on Test Driven Development using the native Go test framework. The ./app directory contains a set of test files (app/topic_test.go) and a corresponding app skeleton file (app/topic.go) with the required function definitions but missing the implementations. Treat the topic_test.go files as the specifications for the function skeletons. The goal is to provide the implementations in the skeleton files to pass the tests. If the tests are not passing, dig into the topic_test.go files to figure out what the requirement is, then fix the skeleton file so the tests pass. You are done when all tests pass. You should not have to modify anything in the topic_test.go files, only the topic.go skeleton files (unless the tests have a bug in which case feel free to report it).
The tests are ordered (more or less) by increasing difficulty. The topics covered include
Here's how to work this:
To run the tests and see their results you have some choices.
Visual Studio Code set up for Go programming provides the capability to run individual tests and use breakpoints and other debugger functions.
With this setup, you can run individual tests within the topic_test.go functions. VS Code will superimpose buttons at the top of each test to let you run or debug the test function. This allows you to step into the actual function under test and observe it. You should never have to change anything in the topic_test.go function itself.
This is independent of whether or not the browser test setup is running. You can do both at the same time. If you are viewing the browser based test output while editing with VS Code and you need to debug a specific test, you can use the VS Code test debug function and still update results with a browser refresh
If you want to debug using printouts from within a function under test, the testutil.go file provides the _testLog(s string) function. You can print output using testLog from within a function in an app skeleton file. Due to the way the golang testing system works, the output from these logs may come after the results for that test are printed. The log output specifies the file and line number of where the testLog was called.
This code is set up to be using Modules rather than GOPATH. As it is, it does not import or use any modules besides standard Go libraries. You could probably fix it to use GOPATH if you require that.
$ claude mcp add go_assessment \
-- python -m otcore.mcp_server <graph>