ArrayList addition (inc. test, example and documentation)

This commit is contained in:
emirpasic
2015-03-07 18:05:34 +01:00
parent fdbea4bd27
commit 28f559cc09
9 changed files with 72 additions and 30 deletions
+9
View File
@@ -27,6 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arraystack
import (
"github.com/emirpasic/gods/utils"
"testing"
)
@@ -43,6 +44,10 @@ func TestArrayStack(t *testing.T) {
stack.Push(2)
stack.Push(3)
if actualValue := stack.Values(); !utils.IdenticalSlices(actualValue, []interface{}{3, 2, 1}) {
t.Errorf("Got %v expected %v", actualValue, []interface{}{3, 2, 1})
}
if actualValue := stack.Empty(); actualValue != false {
t.Errorf("Got %v expected %v", actualValue, false)
}
@@ -77,6 +82,10 @@ func TestArrayStack(t *testing.T) {
t.Errorf("Got %v expected %v", actualValue, true)
}
if actualValue := stack.Values(); !utils.IdenticalSlices(actualValue, []interface{}{}) {
t.Errorf("Got %v expected %v", actualValue, []interface{}{})
}
}
func BenchmarkArrayStack(b *testing.B) {