stack

package module
v0.0.0-...-0f9faeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 1 Imported by: 0

README

golang-tdd-example

Build Status Go Report Card Coverage Status GoDoc

Test driven development in Golang based on Martin Fowlers stack example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	Stack []interface{}
	sync.Mutex
}

Stack is the struct which implments the methods Push, Pop, Top, IsEmpty

func NewStack

func NewStack() *Stack

NewStack returns a new Stack struct

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

IsEmpty returns true if the stack is empty or nil

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop returns and removes the last element of the Stack

func (*Stack) Push

func (s *Stack) Push(item interface{})

Push is adding the given element onto the stack

func (*Stack) Top

func (s *Stack) Top() interface{}

Top returns the last element of the Stack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL