def test_by_random_3d(): dim_num=3 data_len=1000 sample_num=10 outer_loop_num=10 for _o in range(outer_loop_num): data=random_coord(dim_num, data_len) raw=RawSearcher(data) lrtree=LRTree(data) for _i in range(sample_num): lower,upper=random_range(dim_num) exp=raw.query(lower, upper) act=lrtree.query(lower, upper) act.sort() assert_list_equal(exp,act)
def test_by_mesh_grid_3d(): dim_num = 3 data_per_dim=10 xs=[i/data_per_dim for i in range(data_per_dim)] data = mesh_grid_3d(xs,xs,xs) random.shuffle(data) sample_num=1000 raw=RawSearcher(data) lrtree=LRTree(data) for _i in range(sample_num): lower,upper=random_range(dim_num) exp=raw.query(lower, upper) act=lrtree.query(lower, upper) act.sort() assert_list_equal(exp,act)