Ejemplo n.º 1
0
    public void MaxHashNodePullFuncTests()
    {
        // Arrange
        MaxIntHeap maxIntHeap = new MaxIntHeap();

        // 10 15 20 17
        int[] arrayAnswer = { 15, 17, 20 };
        int[] myArray     = new int[4];
        maxIntHeap.add(10);
        maxIntHeap.add(15);
        maxIntHeap.add(20);
        maxIntHeap.add(17);

        // Act
        maxIntHeap.pull();

        // Assert
        Assert.Equal(17, maxIntHeap.pull());
    }
Ejemplo n.º 2
0
    public void MaxIntHeap_Test()
    {
        // Test for MinHash Creation, add, and pull
        // Arrange
        MaxIntHeap maxIntHeap = new MaxIntHeap();

        int[] arrayAnswer = { 10, 15, 20, 17 };
        int[] myArray     = new int[4];

        // Act
        maxIntHeap.add(10);
        maxIntHeap.add(15);
        maxIntHeap.add(20);
        maxIntHeap.add(17);

        // Assert
        Assert.Equal(20, maxIntHeap.pull());
        Assert.Equal(17, maxIntHeap.pull());
        Assert.Equal(15, maxIntHeap.pull());
        Assert.Equal(10, maxIntHeap.pull());
    }
Ejemplo n.º 3
0
    public void Pull_ZeroSizeTree_ThrowsArgumentOutofRangeException()
    {
        // Arrange
        MinIntHeap minIntHeap = new MinIntHeap(0);
        MaxIntHeap maxIntHeap = new MaxIntHeap(0);

        // Assert
        var ex = Assert.Throws <ArgumentOutOfRangeException>(() => minIntHeap.pull());

        Assert.Contains("Tree size is zero", ex.Message);

        var ex2 = Assert.Throws <ArgumentOutOfRangeException>(() => maxIntHeap.pull());

        Assert.Contains("Tree size is zero", ex2.Message);
    }