コード例 #1
0
ファイル: test_validate_bst.py プロジェクト: emptyset/ctci
def test_is_bst__nothing():
    assert is_bst(None)
コード例 #2
0
ファイル: test_validate_bst.py プロジェクト: emptyset/ctci
def test_is_bst__not_at_all():
    root = BinaryNode(7, left=BinaryNode(9), right=BinaryNode(1))
    assert not is_bst(root)
コード例 #3
0
ファイル: test_validate_bst.py プロジェクト: emptyset/ctci
def test_is_bst__simple():
    root = BinaryNode(2, left=BinaryNode(1), right=None)
    assert is_bst(root)
コード例 #4
0
ファイル: test_validate_bst.py プロジェクト: emptyset/ctci
def test_is_bst__complex():
    root = to_bst([1, 2, 3, 4, 5, 6, 7, 8])
    assert is_bst(root)
コード例 #5
0
ファイル: test_validate_bst.py プロジェクト: emptyset/ctci
def test_is_bst__one():
    assert is_bst(BinaryNode(1))