r26349: More tests.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 8 Dec 2007 22:32:23 +0000 (23:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:48:54 +0000 (05:48 +0100)
(This used to be commit c440b130a9d57c1928fb5aef34fa4c00c7e46cff)

source4/param/loadparm.c
source4/param/tests/loadparm.c

index 19f5b8b6ca00a8193fb587188dc1d685228494c6..8cdc82c96133a396070e3eb0496d4a5e34fb20bd 100644 (file)
@@ -1187,10 +1187,10 @@ bool lp_add_printer(struct loadparm_context *lp_ctx,
        return true;
 }
 
-/***************************************************************************
- Map a parameter's string representation to something we can use. 
- Returns False if the parameter string is not recognised, else TRUE.
-***************************************************************************/
+/**
Map a parameter's string representation to something we can use. 
Returns False if the parameter string is not recognised, else TRUE.
+ */
 
 static int map_parameter(const char *pszParmName)
 {
@@ -1213,7 +1213,7 @@ static int map_parameter(const char *pszParmName)
 }
 
 
-/*
+/**
   return the parameter structure for a parameter
 */
 struct parm_struct *lp_parm_struct(const char *name)
@@ -1223,7 +1223,7 @@ struct parm_struct *lp_parm_struct(const char *name)
        return &parm_table[parmnum];
 }
 
-/*
+/**
   return the parameter pointer for a parameter
 */
 void *lp_parm_ptr(struct loadparm_context *lp_ctx,
@@ -1348,11 +1348,10 @@ static void copy_service(struct loadparm_service *pserviceDest,
        }
 }
 
-/***************************************************************************
-Check a service for consistency. Return False if the service is in any way
-incomplete or faulty, else True.
-***************************************************************************/
-
+/**
+ * Check a service for consistency. Return False if the service is in any way
+ * incomplete or faulty, else True.
+ */
 static bool service_ok(struct loadparm_service *service)
 {
        bool bRetval;
@@ -1429,7 +1428,6 @@ static void add_to_file_list(struct loadparm_context *lp_ctx,
 /*******************************************************************
  Check if a config file has changed date.
 ********************************************************************/
-
 bool lp_file_list_changed(struct loadparm_context *lp_ctx)
 {
        struct file_lists *f;
index fa7d7fe1764727d510dba6d51ef210cb69909171..1d689c0a9a18357e55b29a2a2654096ff29822c9 100644 (file)
@@ -97,6 +97,17 @@ static bool test_lp_parm_bytes(struct torture_context *tctx)
        return true;
 }
 
+static bool test_lp_do_service_parameter(struct torture_context *tctx)
+{
+       struct loadparm_context *lp_ctx = loadparm_init(tctx);
+       struct loadparm_service *service = lp_add_service(lp_ctx, &sDefault, "foo");
+       torture_assert(tctx, lp_do_service_parameter(lp_ctx, service, 
+                                                    "some:thing", "foo"), "lp_set_option failed");
+       torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, service, "some", "thing"), "foo",
+                                "invalid parametric option");
+       return true;
+}
+
 struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
 {
        struct torture_suite *suite = torture_suite_create(mem_ctx, "LOADPARM");
@@ -109,6 +120,7 @@ struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
        torture_suite_add_simple_test(suite, "set_lp_parm_bool", test_lp_parm_bool);
        torture_suite_add_simple_test(suite, "set_lp_parm_int", test_lp_parm_int);
        torture_suite_add_simple_test(suite, "set_lp_parm_bytes", test_lp_parm_bytes);
+       torture_suite_add_simple_test(suite, "service_parameter", test_lp_do_service_parameter);
 
        return suite;
 }