gupta_test.go 621 B

12345678910111213141516171819202122232425262728293031
  1. package gupta
  2. import (
  3. "testing"
  4. )
  5. func TestHello(t *testing.T) {
  6. got := Hello()
  7. want := "Hello, world"
  8. if got != want {
  9. t.Errorf("got %q want %q", got, want)
  10. }
  11. }
  12. func TestRunGupta(t *testing.T) {
  13. // test that we get CPU load
  14. got := make([]float64, 3)
  15. got[0], got[1], got[2] = Run(true, true, true, "", "")
  16. want := []float64{0.2, 0.2, 70.0}
  17. for i, v := range got {
  18. if v != want[i] {
  19. t.Errorf("got %v want %v", v, want[i])
  20. }
  21. }
  22. // here it makes sense to return some kind of data structure
  23. // with properties filled.
  24. // having a data structure it would be possible to format
  25. // it to json ...
  26. }