From c4d6e924869fd430132c282426f573818fcfa952 Mon Sep 17 00:00:00 2001 From: "qiheng.zhou" Date: Mon, 16 Sep 2024 17:34:07 +0800 Subject: [PATCH] test: length check --- container/strstore/strstore_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/container/strstore/strstore_test.go b/container/strstore/strstore_test.go index 6c12703..af66f8f 100644 --- a/container/strstore/strstore_test.go +++ b/container/strstore/strstore_test.go @@ -27,9 +27,12 @@ func TestStrStore(t *testing.T) { // test when the pages grow ss := randStrings(50, 1000000) strStore, idxes := New(ss) + totalLen := 0 for i := 0; i < len(ss); i++ { assert.Equal(t, ss[i], strStore.Get(idxes[i])) + totalLen += len(ss[i]) } + assert.Equal(t, totalLen+strlenSize*len(ss), strStore.Len()) s := strStore.Get(-1) assert.Equal(t, "", s) s = strStore.Get(strStore.Len() * 2)