Testing example

so this pull request concerns avg.go, avg_test.go and testUtils.go. All the rest is the result of a rogue go fmt. 

The pattern I settle on was that each block should have a test script. That script can use the convenience functions in testUtils.go

Still to come for the utils is TestTransfer, which should specify an inbound message and the expected outbound message. Will do that next.