Revision 48ad042083b8bca89eec4dae96dd78416d8c8776 authored by Iddan Aaronsohn on 22 October 2019, 21:50:39 UTC, committed by Iddan Aaronsohn on 22 October 2019, 22:17:08 UTC
1 parent 9c79218
Raw File
unique_test.go
package iterator_test

import (
	"context"
	"testing"

	"github.com/stretchr/testify/require"

	. "github.com/cayleygraph/cayley/graph/iterator"
)

func TestUniqueIteratorBasics(t *testing.T) {
	ctx := context.TODO()
	allIt := NewFixed(
		Int64Node(1),
		Int64Node(2),
		Int64Node(3),
		Int64Node(3),
		Int64Node(2),
	)

	u := NewUnique(allIt)

	expect := []int{1, 2, 3}
	for i := 0; i < 2; i++ {
		require.Equal(t, expect, iterated(u))
	}

	uc := u.Lookup()
	for _, v := range []int{1, 2, 3} {
		require.True(t, uc.Contains(ctx, Int64Node(v)))
	}
}
back to top