Commit b0cc5bda authored by Mikkel Wienberg Madsen's avatar Mikkel Wienberg Madsen 👀
Browse files

Test Intersection

parent 93f2d66f
package election
import (
"testing"
"github.com/google/uuid"
)
func TestIntersection(t *testing.T) {
N := 7
elem := make([]uuid.UUID, N)
for i := 0; i < N; i++ {
elem[i] = uuid.New()
}
superset := [][]uuid.UUID{
[]uuid.UUID{elem[0], elem[1], elem[2], elem[3]},
[]uuid.UUID{elem[0], elem[1], elem[2], elem[4]},
[]uuid.UUID{elem[0], elem[1], elem[2], elem[5]},
[]uuid.UUID{elem[0], elem[1], elem[2], elem[6]},
}
subset := Intersection(superset)
if !subset[elem[0]] { t.Fail() }
if !subset[elem[1]] { t.Fail() }
if !subset[elem[2]] { t.Fail() }
if subset[elem[3]] { t.Fail() }
if subset[elem[4]] { t.Fail() }
if subset[elem[5]] { t.Fail() }
if subset[elem[6]] { t.Fail() }
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment