Пример #1
0
def test_1_overlapping():
    testName = "test_1_overlapping"
    running(testName)
    correct = False
    
    known1 = Point(0, 0)
    known2 = Point(0, 0)

    dExp = 0
    dTest = euclidian_distance(known1, known2)

    correct = dExp == dTest

    if correct: passed(testName)
    else: failed(testName, dTest, dExp)
    assert correct
Пример #2
0
def test_3_pythag():
    testName = "test_3_pythag"
    running(testName)
    correct = False
    
    d = 10
    known1 = Point(0, 0)
    known2 = Point(6, 8)

    dExp = d
    dTest = euclidian_distance(known1, known2)

    correct = dExp == dTest

    if correct: passed(testName)
    else: failed(testName, dTest, dExp)
    assert correct
Пример #3
0
    def test_addPointValue(self):
        testName = "TestMap.test_addPointValue"
        running(testName)
        correct = True

        H = 3
        W = 4
        M = getTestMap(W, H)

        M.addRawPointValue(PointValue(W + 1, H + 1, 0))
        gotL = len(M.RawPointValues)
        expL = H * W + 1
        correct = gotL == expL
        if not correct: failed(testName, gotL, expL)

        if correct: passed(testName)
        assert correct
Пример #4
0
def test_2_unitDistance():
    testName = "test_2_unitDistance"
    running(testName)
    correct = False

    d = 1
    known1 = Point(0, 0)
    known2 = Point(0 + d, 0)

    dExp = d
    dTest = euclidian_distance(known1, known2)

    correct = dExp == dTest
    
    if correct: passed(testName)
    else: failed(testName, dTest, dExp)
    assert correct
Пример #5
0
def test_1_overlapping():
    testName = "test_1_overlapping"
    running(testName)
    correct = False

    x = 3
    y = 4
    z = 5

    p = Point(x, y)
    pv = PointValue(x, y, z)

    expWt = z
    gotWt = inverse_weight(p, [pv])

    correct = gotWt == expWt
    if correct: passed(testName)
    else: failed(testName, gotWt, expWt)
    assert correct
Пример #6
0
def test_1_overlapping():
    testName = "test_1_overlapping"
    running(testName)
    correct = False

    x = 3
    y = 4
    z = 5

    p = Point(x, y)
    pv = PointValue(x, y, z)

    expV = z
    gotV = step(p, [pv])

    correct = gotV == expV
    if correct: passed(testName)
    else: failed(testName, gotV, expV)
    assert correct
Пример #7
0
def test_2_singleRawPt():
    testName = "test_2_singleRawPt"
    running(testName)
    correct = False

    x = 3
    y = 4
    z = 5
    d = 10E3

    p = Point(x, y)
    pv = PointValue(x + d, y + d, z)

    expWt = z
    gotWt = inverse_weight(p, [pv])

    correct = gotWt == expWt
    if correct: passed(testName)
    else: failed(testName, gotWt, expWt)
    assert correct
Пример #8
0
def test_2_singleRawPt():
    testName = "test_2_singleRawPt"
    running(testName)
    correct = False

    x = 3
    y = 4
    z = 5
    d = 10E3

    p = Point(x, y)
    pv = PointValue(x + d, y + d, z)

    expV = z
    gotV = step(p, [pv])

    correct = gotV == expV
    if correct: passed(testName)
    else: failed(testName, gotV, expV)
    assert correct
Пример #9
0
def test_3_symmetric():
    testName = "test_3_symmetric"
    running(testName)
    correct = False

    x = 3
    y = 4
    z = 5
    d = 10

    p1 = Point(x + d, y + d)
    pv = PointValue(x, y, z)
    p2 = Point(x - d, y - d)

    gotWt1 = inverse_weight(p1, [pv])
    gotWt2 = inverse_weight(p2, [pv])

    correct = gotWt1 == gotWt2
    if correct: passed(testName)
    else: failed(testName, f"{gotWt1} != {gotWt2}", f"{gotWt1} == {gotWt2}")
    assert correct
Пример #10
0
    def test_ctor(self):
        testName = "TestMap.test_ctor"
        running(testName)
        correct = True

        H = 5
        W = 3
        M = getTestMap(W, H)
        correct = len(M.RawPointValues) == H * W

        gotXr = M.XRange
        expXr = (0, W - 1)
        correct = gotXr == expXr
        if not correct: failed(testName, gotXr, expXr)

        gotYr = M.YRange
        expYr = (0, H - 1)
        correct = gotYr == expYr
        if not correct: failed(testName, gotYr, expYr)

        if correct: passed(testName)
        assert correct
Пример #11
0
    def test_removeRawPointValue(self):
        testName = "TestMap.test_removeRawPointValue"
        running(testName)
        correct = True

        H = 6
        W = 6
        M = getTestMap(W, H)

        gotL = len(M.RawPointValues)
        expL = H * W
        correct = gotL == expL
        if not correct: failed(testName, gotL, expL)

        M.removeRawPointValue(W - 1, H - 1)

        gotL = len(M.RawPointValues)
        expL = H * W - 1
        correct = gotL == expL
        if not correct: failed(testName, gotL, expL)

        if correct: passed(testName)
        assert correct