/* basic testing of session/tree context calls */ static BOOL torture_raw_context_int(void) { struct smbcli_state *cli; BOOL ret = True; TALLOC_CTX *mem_ctx; if (!torture_open_connection(&cli, 0)) { return False; } mem_ctx = talloc_init("torture_raw_context"); ret &= test_session(cli, mem_ctx); ret &= test_tree(cli, mem_ctx); ret &= test_tree_ulogoff(cli, mem_ctx); ret &= test_pid_exit_only_sees_open(cli, mem_ctx); ret &= test_pid_2sess(cli, mem_ctx); ret &= test_pid_2tcon(cli, mem_ctx); smb_raw_exit(cli->session); smbcli_deltree(cli->tree, BASEDIR); torture_close_connection(cli); talloc_free(mem_ctx); return ret; }
int main() { test_algo(); test_hook(); test_tree(); // int x = *((int*)0); // ralgo::rebalance_after_erasure(&header, 0, &n5); return 0; }
// Test libtree stuff int main(int argc, const char *argv[]){ int tests = 1; int success = 0; printf(">>>> Starting libtree tests\n"); if(test_tree()){ success++; printf(">>> [%d/%d] test_tree() SUCCESS\n", success, tests); } else { printf(">>> [%d/%d] test_tree() FAIL\n", success, tests); } }
int main() { mgr = navi_mgr_init("./conf"); single_drive(); sub_normal_drive(); absub_normal_drive(); notexist_drive(); test_tree(); navi_mgr_free(mgr); return 0; }
static tree test_tree (int i= 0, int d= 3) { // cout << "i= " << i << ", d= " << d << "\n"; if (d == 0) return tree (as_string (i)); else { int n= 6 + ((int) (2 * sin (1.0 * i * d))); tree t (TUPLE, n); for (int j=0; j<n; i++, j++) t[j]= test_tree (i, d-1); return t; } }
static void test_identity (int N) { const double bounds[6] = { -1, 1, -1, 1, -1, 1 }; p8est_geometry_t *geom; P4EST_STATISTICS ("Test identity\n"); geom = p8est_geometry_new_identity (); test_tree (geom, 0, bounds, N); P4EST_FREE (geom); }
static void test_shell (int N) { const double bounds[6] = { -1, 1, -1, 1, 1, 2 }; p4est_topidx_t jt; p8est_geometry_t *geom; P4EST_STATISTICS ("Test shell\n"); geom = p8est_geometry_new_shell (6371, 3480); for (jt = 0; jt < 24; ++jt) { test_tree (geom, jt, bounds, N); } P4EST_FREE (geom); }
int main() { char remove[2]; remove[1] = 0; for(*remove='A'; *remove<'Z'; (*remove)++) { BOSTree *t = test_tree(); bostree_remove(t, bostree_lookup(t, remove)); test_tree_sanity(t); if(bostree_node_count(t) != ('Z' - 'A' - 1)) { printf("Removed one node from a tree, but the node count did not decrease properly.\n"); exit(1); } bostree_destroy(t); } return 0; }
void test_commute () { tree tt= test_tree (); for (int i=0; i<42; i++) for (int j=0; j<42; j++) { modification m1= test_modification (i); modification m2= test_modification (j); modification t1= m1; modification t2= m2; debug_std << "m1 = " << m1 << "\n"; debug_std << "m2 = " << m2 << "\n"; bool r= swap (m1, m2); modification u1= m1; modification u2= m2; if (!r) debug_std << " Modifications do not commute\n\n"; else { debug_std << "m1' = " << m1 << "\n"; debug_std << "m2' = " << m2 << "\n"; if (clean_apply (clean_apply (tt, t1), t2) != clean_apply (clean_apply (tt, m1), m2)) { failed_error << "t1 = " << clean_apply (clean_apply (tt, t1), t2) << "\n"; failed_error << "t2 = " << clean_apply (clean_apply (tt, m1), m2) << "\n"; FAILED ("inconsistency"); } r= swap (m1, m2); if (!r) debug_std << "r = " << r << "\n"; else if (m1 != t1 || m2 != t2) { debug_std << "m1''= " << m1 << "\n"; debug_std << "m2''= " << m2 << "\n"; r= swap (m1, m2); if (!r) debug_std << "r = " << r << "\n"; else if (m1 != u1 || m2 != u2) { debug_std << "m1* = " << m1 << "\n"; debug_std << "m2* = " << m2 << "\n"; r= false; } } if (r) debug_std << " Consistency check succeeded\n\n"; else { failed_error << " Consistency check failed\n\n"; FAILED ("inconsistency"); } } } }
/* basic testing of session/tree context calls */ static bool torture_raw_context_int(struct torture_context *tctx, struct smbcli_state *cli) { bool ret = true; ret &= test_session(cli, tctx); ret &= test_tree(cli, tctx); ret &= test_tree_ulogoff(cli, tctx); ret &= test_pid_exit_only_sees_open(cli, tctx); ret &= test_pid_2sess(cli, tctx); ret &= test_pid_2tcon(cli, tctx); smb_raw_exit(cli->session); smbcli_deltree(cli->tree, BASEDIR); return ret; }
static void test_sphere (int N) { /* *INDENT-OFF* */ const double boundsS[6] = { -1, 1, -1, 1, 1, 2 }; const double boundsC[6] = { -1, 1, -1, 1, -1, 1 }; /* *INDENT-ON* */ p4est_topidx_t jt; p8est_geometry_t *geom; P4EST_STATISTICS ("Test sphere\n"); geom = p8est_geometry_new_sphere (3, 2, 1); for (jt = 0; jt < 13; ++jt) { test_tree (geom, jt, jt < 12 ? boundsS : boundsC, N); } P4EST_FREE (geom); }
void test_invert () { tree t1= test_tree (); for (int i=0; i<42; i++) { modification m1= test_modification (i); tree t2= clean_apply (t1, m1); modification m2= invert (m1, t1); tree t3= clean_apply (t2, m2); modification m3= invert (m2, t2); if (m1 != m3 || t1 != t3) { cout << "t1= " << t1 << "\n"; cout << "m1= " << m1 << "\n"; cout << "t2= " << t2 << "\n"; cout << "m2= " << m2 << "\n"; cout << "t3= " << t3 << "\n"; FAILED ("inconsistency"); } } }
int main() { TreeNode *tree = NULL; TreeNode *node; guint i; g_assert (!add_tree (&tree, 1)); g_assert (!add_tree (&tree, 2)); g_assert (!add_tree (&tree, 3)); g_assert ( add_tree (&tree, 1)); g_assert ( add_tree (&tree, 2)); g_assert ( add_tree (&tree, 3)); g_assert (!test_tree (&tree, 0)); g_assert ( test_tree (&tree, 1)); g_assert ( test_tree (&tree, 2)); g_assert ( test_tree (&tree, 3)); g_assert (!test_tree (&tree, 4)); g_assert (!del_tree (&tree, 0)); g_assert ( del_tree (&tree, 2)); g_assert (!del_tree (&tree, 4)); g_assert (!test_tree (&tree, 0)); g_assert ( test_tree (&tree, 1)); g_assert (!test_tree (&tree, 2)); g_assert ( test_tree (&tree, 3)); g_assert (!test_tree (&tree, 4)); g_assert ( add_tree (&tree, 1)); g_assert (!add_tree (&tree, 2)); g_assert ( add_tree (&tree, 3)); g_assert ( del_tree (&tree, 1)); g_assert ( del_tree (&tree, 2)); g_assert ( del_tree (&tree, 3)); g_assert (tree == NULL); GSK_RBTREE_FIRST (TREE(&tree), node); g_assert (node == NULL); GSK_RBTREE_LAST (TREE(&tree), node); g_assert (node == NULL); /* Construct tree with odd numbers 1..999 inclusive */ for (i = 1; i <= 999; i += 2) g_assert (!add_tree (&tree, i)); GSK_RBTREE_FIRST (TREE(&tree), node); g_assert (node != NULL); g_assert (node->value == 1); GSK_RBTREE_LAST (TREE(&tree), node); g_assert (node != NULL); g_assert (node->value == 999); for (i = 1; i <= 999; i += 2) { g_assert (test_tree (&tree, i)); g_assert (!test_tree (&tree, i+1)); } for (i = 0; i <= 999; i++) { GSK_RBTREE_SUPREMUM_COMPARATOR (TREE(&tree), i, COMPARE_INT_WITH_TREE_NODE, node); g_assert (node); g_assert (node->value == (i%2)?i:(i+1)); } GSK_RBTREE_SUPREMUM_COMPARATOR (TREE(&tree), 1000, COMPARE_INT_WITH_TREE_NODE, node); g_assert (node==NULL); for (i = 1; i <= 1000; i++) { TreeNode *node; GSK_RBTREE_INFIMUM_COMPARATOR (TREE(&tree), i, COMPARE_INT_WITH_TREE_NODE, node); g_assert (node); g_assert (node->value == (i%2)?i:(i-1)); } GSK_RBTREE_INFIMUM_COMPARATOR (TREE(&tree), 0, COMPARE_INT_WITH_TREE_NODE, node); g_assert (node==NULL); for (i = 1; i <= 999; i += 2) g_assert (del_tree (&tree, i)); /* random rbctree test */ g_printerr ("Testing RBC-tree macros... "); for (i = 0; i < 1000; i++) test_random_rbcint_tree (10, TRUE); g_printerr ("."); for (i = 0; i < 100; i++) test_random_rbcint_tree (100, TRUE); g_printerr ("."); for (i = 0; i < 50; i++) { test_random_rbcint_tree (1000, FALSE); g_printerr ("."); } for (i = 0; i < 5; i++) { test_random_rbcint_tree (10000, FALSE); g_printerr ("."); } g_printerr (" done.\n"); return 0; }
int main() { Red_Black_Tree<int, int> test_tree(); return 0; }
int main(int argc, char **argv) { //test_stack(); test_tree(); return 0; }