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.
17 lines
376 B
17 lines
376 B
3 years ago
|
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["不不不"])
|
||
|
}
|