(pop, push int)
| 23 | ) |
| 24 | |
| 25 | func makeStackFunc(pop, push int) stackValidationFunc { |
| 26 | return func(stack *Stack) error { |
| 27 | if err := stack.require(pop); err != nil { |
| 28 | return err |
| 29 | } |
| 30 | |
| 31 | if stack.len()+push-pop > int(configs.StackLimit) { |
| 32 | return fmt.Errorf("stack limit reached %d (%d)", stack.len(), configs.StackLimit) |
| 33 | } |
| 34 | return nil |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func makeDupStackFunc(n int) stackValidationFunc { |
| 39 | return makeStackFunc(n, n+1) |
no test coverage detected