|
@@ -94,3 +94,17 @@ func TestFIFOInt(t *testing.T) {
|
|
|
t.Errorf("Buffer did not return expected value 30: %d", x)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func TestFIFOStr(t *testing.T) {
|
|
|
+ buffer := NewFIFOBuffer[string](2)
|
|
|
+ buffer.Push("Fish")
|
|
|
+ buffer.Push("Cat")
|
|
|
+ x := buffer.Pop()
|
|
|
+ if x != "Cat" {
|
|
|
+ t.Errorf("Expected Cat, got %s", x)
|
|
|
+ }
|
|
|
+ x = buffer.Pop()
|
|
|
+ if x != "Fish" {
|
|
|
+ t.Errorf("Expected Fish, got %s", x)
|
|
|
+ }
|
|
|
+}
|