k_test.go 596 B

123456789101112131415161718192021
  1. package kata_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. )
  6. var _ = Describe("Tests", func() {
  7. It("Basic tests", func() {
  8. Describe("Empty arrays should have a max of 0", func() {
  9. Expect(MaximumSubarraySum([]int{})).To(Equal(0))
  10. })
  11. Describe("Example array should have a max of 6", func() {
  12. Expect(MaximumSubarraySum([]int{-2, 1, -3, 4, -1, 2, 1, -5, 4})).To(Equal(6))
  13. })
  14. Describe("Example array with all negative values should have a max of 0", func() {
  15. Expect(MaximumSubarraySum([]int{-2, -1, -3, -4, -1, -2, -1, -5, -4})).To(Equal(0))
  16. })
  17. })
  18. })