github.com/weaviate/weaviate@v1.24.6/usecases/scaler/distribution_test.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package scaler
    13  
    14  import (
    15  	"testing"
    16  
    17  	"github.com/stretchr/testify/assert"
    18  )
    19  
    20  func TestDifference(t *testing.T) {
    21  	tests := []struct {
    22  		xs, ys, zs []string
    23  	}{
    24  		{
    25  			zs: []string{},
    26  		},
    27  		{
    28  			xs: []string{"1", "2"},
    29  			ys: []string{},
    30  			zs: []string{"1", "2"},
    31  		},
    32  		{
    33  			xs: []string{"1", "2"},
    34  			ys: []string{"1", "2"},
    35  			zs: []string{},
    36  		},
    37  		{
    38  			xs: []string{"1", "2", "3", "4"},
    39  			ys: []string{"1", "3"},
    40  			zs: []string{"2", "4"},
    41  		},
    42  		{
    43  			xs: []string{"1", "2", "3", "4"},
    44  			ys: []string{"2", "4"},
    45  			zs: []string{"1", "3"},
    46  		},
    47  	}
    48  	for _, c := range tests {
    49  		assert.Equal(t, c.zs, difference(c.xs, c.ys))
    50  	}
    51  }