forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
376 B
16 lines
376 B
package fly_weight
|
|
|
|
import (
|
|
"github.com/bmizerany/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestFlyWeightFactory_GetFlyWeight(t *testing.T) {
|
|
factory := NewFlyWeightFactory()
|
|
a := factory.GetFlyWeight("啊啊啊")
|
|
b := factory.GetFlyWeight("不不不")
|
|
|
|
// assert.Len(&t, factory.pool, 2)
|
|
assert.Equal(t, a, factory.pool["啊啊啊"])
|
|
assert.Equal(t, b, factory.pool["不不不"])
|
|
}
|
|
|