k_test.go 955 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package kata_test
  2. import (
  3. "fmt"
  4. . "github.com/onsi/ginkgo"
  5. . "github.com/onsi/gomega"
  6. . "code.osinet.fr/fgm/codewars/kyu7/functions_of_integers_on_cartesian_plane"
  7. )
  8. func dotestSuMin(n int, exp int64) {
  9. fmt.Printf("SuMin n %v\n", n)
  10. var ans = SuMin(n)
  11. Expect(ans).To(Equal(exp))
  12. }
  13. func dotestSuMax(n int, exp int64) {
  14. fmt.Printf("SuMax n %v\n", n)
  15. var ans = SuMax(n)
  16. Expect(ans).To(Equal(exp))
  17. }
  18. func dotestSumSum(n int, exp int64) {
  19. fmt.Printf("SumSum n %v\n", n)
  20. var ans = SumSum(n)
  21. Expect(ans).To(Equal(exp))
  22. }
  23. func sumin() {
  24. dotestSuMin(5, 55)
  25. dotestSuMin(100, 338350)
  26. }
  27. func sumax() {
  28. dotestSuMax(5, 95)
  29. dotestSuMax(100, 671650)
  30. }
  31. func susum() {
  32. dotestSumSum(5, 150)
  33. dotestSumSum(100, 671650+338350)
  34. }
  35. var _ = Describe("Tests", func() {
  36. It("should handle basic min cases", func() {
  37. sumin()
  38. })
  39. It("should handle basic max cases", func() {
  40. sumax()
  41. })
  42. It("should handle basic sum cases", func() {
  43. susum()
  44. })
  45. })