mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 16:25:21 +00:00
eb856b5a1f
* delete incentive reward index on repay/withdraw * call hook on borrow in all cases * additional types functionality * extend tests to cover fix * update naming convention in tests * update test comment * feat: add set difference unit tests * clarify test names Co-authored-by: karzak <kjydavis3@gmail.com>
30 lines
940 B
Go
30 lines
940 B
Go
package keeper
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSetDiff(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
setA []string
|
|
setB []string
|
|
expected []string
|
|
}{
|
|
{"empty", []string{}, []string{}, []string(nil)},
|
|
{"diff equal sets", []string{"busd", "usdx"}, []string{"busd", "usdx"}, []string(nil)},
|
|
{"diff set empty", []string{"bnb", "ukava", "usdx"}, []string{}, []string{"bnb", "ukava", "usdx"}},
|
|
{"input set empty", []string{}, []string{"bnb", "ukava", "usdx"}, []string(nil)},
|
|
{"diff set with common elements", []string{"bnb", "btcb", "usdx", "xrpb"}, []string{"bnb", "usdx"}, []string{"btcb", "xrpb"}},
|
|
{"diff set with all common elements", []string{"bnb", "usdx"}, []string{"bnb", "btcb", "usdx", "xrpb"}, []string(nil)},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
require.Equal(t, tt.expected, setDifference(tt.setA, tt.setB))
|
|
})
|
|
}
|
|
}
|