diff options
author | Kamen Mazdrashki <kamen.mazdrashki@postpath.com> | 2009-10-24 03:01:01 +0300 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-11-06 14:05:38 +0100 |
commit | 3d91c8ef5a115171f96d33606879ab7d871f3e3d (patch) | |
tree | 4b26ff0484ae039fec2f55d82b17747611a9ef40 /source4 | |
parent | 3fe4310df73cf2a314982fe62793ea33d44c5499 (diff) | |
download | samba-3d91c8ef5a115171f96d33606879ab7d871f3e3d.tar.gz samba-3d91c8ef5a115171f96d33606879ab7d871f3e3d.tar.bz2 samba-3d91c8ef5a115171f96d33606879ab7d871f3e3d.zip |
s4/drs(tort): implement prefixMap comparison function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/drs/unit/prefixmap_tests.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source4/torture/drs/unit/prefixmap_tests.c b/source4/torture/drs/unit/prefixmap_tests.c index 54bd6612f7..16d8298ef2 100644 --- a/source4/torture/drs/unit/prefixmap_tests.c +++ b/source4/torture/drs/unit/prefixmap_tests.c @@ -180,14 +180,34 @@ static WERROR _drsut_prefixmap_new(const struct drsut_pfm_oid_data *_pfm_init_da return WERR_OK; } +static bool _torture_drs_pfm_compare_same(struct torture_context *tctx, + const struct dsdb_schema_prefixmap *pfm_left, + const struct dsdb_schema_prefixmap *pfm_right) +{ + uint32_t i; + + torture_assert_int_equal(tctx, pfm_left->length, pfm_right->length, + "prefixMaps differ in size"); + for (i = 0; i < pfm_left->length; i++) { + struct dsdb_schema_prefixmap_oid *entry_left = &pfm_left->prefixes[i]; + struct dsdb_schema_prefixmap_oid *entry_right = &pfm_right->prefixes[i]; + + torture_assert(tctx, entry_left->id == entry_right->id, + talloc_asprintf(tctx, "Different IDs for index=%d", i)); + torture_assert_data_blob_equal(tctx, entry_left->bin_oid, entry_right->bin_oid, + talloc_asprintf(tctx, "Different bin_oid for index=%d", i)); + } + + return true; +} /* * Tests dsdb_schema_pfm_new() */ static bool torture_drs_unit_pfm_new(struct torture_context *tctx, struct drsut_prefixmap_data *priv) { - int i; WERROR werr; + bool bret; TALLOC_CTX *mem_ctx; struct dsdb_schema_prefixmap *pfm = NULL; @@ -201,21 +221,11 @@ static bool torture_drs_unit_pfm_new(struct torture_context *tctx, struct drsut_ torture_assert(tctx, pfm->prefixes != NULL, "No prefixes for newly created prefixMap!"); /* compare newly created prefixMap with template one */ - torture_assert(tctx, priv->pfm_new->length == pfm->length, - "Newly created prefixMap differs in length with expected one"); - for (i = 0; i < pfm->length; i++) { - struct dsdb_schema_prefixmap_oid *pfm_oid = &pfm->prefixes[i]; - struct dsdb_schema_prefixmap_oid *pfm_oid_exp = &priv->pfm_new->prefixes[i]; - - torture_assert(tctx, pfm_oid->id == pfm_oid_exp->id, - talloc_asprintf(mem_ctx, "Different IDs for index=%d", i)); - torture_assert_data_blob_equal(tctx, pfm_oid->bin_oid, pfm_oid_exp->bin_oid, - talloc_asprintf(mem_ctx, "Different bin_oid for index=%d", i)); - } + bret = _torture_drs_pfm_compare_same(tctx, priv->pfm_new, pfm); talloc_free(mem_ctx); - return true; + return bret; } /** |