package net.ranides.assira.collection.sets;

import net.ranides.test.ContractTesters;
import net.ranides.test.data.TCollection;
import net.ranides.test.data.TMaps;
import net.ranides.test.data.TPoint;
import org.junit.Test;

import java.io.Serializable;
import java.util.Comparator;

public class ArraySetTest {
    private final TCollection<TPoint> $var = TMaps.MAP_PI.keys();

    private final Comparator<TPoint> $cmp = (Serializable & Comparator<TPoint>)(a, b) -> {
        int x = Integer.compare(a.x, b.x);
        int y = Integer.compare(a.y, b.y);
        int z = Integer.compare(a.z, b.z);
        return x != 0 ? x : y != 0 ? y : z;
    };

    @Test
    public void testSuite() {
        ContractTesters.runner()
            .param("collection!", $var)
            .function(new int[0], array -> new ArraySet<>($var.list(array).values(), $cmp))
            .run();

    }

}