From c88992a301eae063e0db557b2ac891f0159b83ca Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Fri, 11 Oct 2024 12:06:35 -0500 Subject: [PATCH] Configurations are immutable and validated at construction. --- bindings/python/cconfigspace/configuration.py | 7 -- .../cconfigspace/configuration_space.py | 7 -- .../python/test/test_configuration_space.py | 10 +-- .../ruby/lib/cconfigspace/configuration.rb | 9 -- .../lib/cconfigspace/configuration_space.rb | 7 -- .../ruby/test/test_configuration_space.rb | 9 +- include/cconfigspace/configuration.h | 24 ------ include/cconfigspace/configuration_space.h | 27 ------ src/configuration.c | 38 ++++----- src/configuration_space.c | 84 ------------------- src/configuration_space_internal.h | 70 ++++++++++++++++ tests/test_condition.c | 20 ----- tests/test_configuration_space.c | 12 --- tests/test_distribution_space.c | 11 --- tests/test_forbidden.c | 20 ----- 15 files changed, 88 insertions(+), 267 deletions(-) diff --git a/bindings/python/cconfigspace/configuration.py b/bindings/python/cconfigspace/configuration.py index 47f67b17..bc328dc5 100644 --- a/bindings/python/cconfigspace/configuration.py +++ b/bindings/python/cconfigspace/configuration.py @@ -7,7 +7,6 @@ ccs_create_configuration = _ccs_get_function("ccs_create_configuration", [ccs_configuration_space, ccs_features, ct.c_size_t, ct.POINTER(Datum), ct.POINTER(ccs_configuration)]) ccs_configuration_get_configuration_space = _ccs_get_function("ccs_configuration_get_configuration_space", [ccs_configuration, ct.POINTER(ccs_configuration_space)]) ccs_configuration_get_features = _ccs_get_function("ccs_configuration_get_features", [ccs_configuration, ct.POINTER(ccs_features)]) -ccs_configuration_check = _ccs_get_function("ccs_configuration_check", [ccs_configuration, ct.POINTER(ccs_bool)]) class Configuration(Binding): def __init__(self, handle = None, retain = False, auto_release = True, @@ -57,9 +56,3 @@ def features(self): else: self._features = None return self._features - - def check(self): - valid = ccs_bool() - res = ccs_configuration_check(self.handle, ct.byref(valid)) - Error.check(res) - return False if valid.value == 0 else True diff --git a/bindings/python/cconfigspace/configuration_space.py b/bindings/python/cconfigspace/configuration_space.py index 1f4822a0..75df65ae 100644 --- a/bindings/python/cconfigspace/configuration_space.py +++ b/bindings/python/cconfigspace/configuration_space.py @@ -15,7 +15,6 @@ ccs_configuration_space_get_conditions = _ccs_get_function("ccs_configuration_space_get_conditions", [ccs_configuration_space, ct.c_size_t, ct.POINTER(ccs_expression), ct.POINTER(ct.c_size_t)]) ccs_configuration_space_get_forbidden_clause = _ccs_get_function("ccs_configuration_space_get_forbidden_clause", [ccs_configuration_space, ct.c_size_t, ct.POINTER(ccs_expression)]) ccs_configuration_space_get_forbidden_clauses = _ccs_get_function("ccs_configuration_space_get_forbidden_clauses", [ccs_configuration_space, ct.c_size_t, ct.POINTER(ccs_expression), ct.POINTER(ct.c_size_t)]) -ccs_configuration_space_check_configuration = _ccs_get_function("ccs_configuration_space_check_configuration", [ccs_configuration_space, ccs_configuration, ct.POINTER(ccs_bool)]) ccs_configuration_space_get_default_configuration = _ccs_get_function("ccs_configuration_space_get_default_configuration", [ccs_configuration_space, ccs_feature_space, ct.POINTER(ccs_configuration)]) ccs_configuration_space_sample = _ccs_get_function("ccs_configuration_space_sample", [ccs_configuration_space, ccs_distribution_space, ccs_feature_space, ccs_rng, ct.POINTER(ccs_configuration)]) ccs_configuration_space_samples = _ccs_get_function("ccs_configuration_space_samples", [ccs_configuration_space, ccs_distribution_space, ccs_feature_space, ccs_rng, ct.c_size_t, ct.POINTER(ccs_configuration)]) @@ -171,12 +170,6 @@ def forbidden_clauses(self): self._forbidden_clauses = tuple(Expression.from_handle(ccs_expression(x)) for x in v) return self._forbidden_clauses - def check(self, configuration): - valid = ccs_bool() - res = ccs_configuration_space_check_configuration(self.handle, configuration.handle, ct.byref(valid)) - Error.check(res) - return False if valid.value == 0 else True - def default_configuration(self, features = None): v = ccs_configuration() if features is not None: diff --git a/bindings/python/test/test_configuration_space.py b/bindings/python/test/test_configuration_space.py index e09c31ab..150f633a 100644 --- a/bindings/python/test/test_configuration_space.py +++ b/bindings/python/test/test_configuration_space.py @@ -23,13 +23,10 @@ def test_create(self): self.assertEqual( h3, cs.parameter(2) ) self.assertEqual( (h1, h2, h3), cs.parameters ) self.assertEqual( h2, cs.parameter_by_name(h2.name) ) - self.assertTrue( cs.check(cs.default_configuration()) ) self.assertIsNone( cs.feature_space ) c = cs.sample() - self.assertTrue( cs.check(c) ) self.assertEqual( cs.handle.value, c.configuration_space.handle.value ) - for c in cs.samples(100): - self.assertTrue( cs.check(c) ) + cs.samples(100) def test_set_distribution(self): h1 = ccs.NumericalParameter.Float() @@ -113,7 +110,7 @@ def extract_active_parameters(self, values): res = ['p1'] for v in values: if v != ccs.inactive: - res += ["p{}".format(m[1]) for m in re.finditer('#P(\d)', v)] + res += ["p{}".format(m[1]) for m in re.finditer('#P(\\d)', v)] return res def test_omp(self): @@ -202,7 +199,6 @@ def test_omp(self): all_params = [ "p{}".format(i) for i in range(1,10) ] for i in range(1000): s = cs.sample() - self.assertTrue( s.check() ) active_params = self.extract_active_parameters(s.values) for par in active_params: self.assertNotEqual( ccs.inactive, s.value(par) ) @@ -274,7 +270,6 @@ def test_omp_parse(self): all_params = [ "p{}".format(i) for i in range(1,10) ] for i in range(1000): s = cs.sample() - self.assertTrue( s.check() ) active_params = self.extract_active_parameters(s.values) for par in active_params: self.assertNotEqual( ccs.inactive, s.value(par) ) @@ -287,7 +282,6 @@ def test_omp_parse(self): cs_copy = ccs.Object.deserialize(buffer = buff) for i in range(1000): s = cs_copy.sample() - self.assertTrue( s.check() ) active_params = self.extract_active_parameters(s.values) for par in active_params: self.assertNotEqual( ccs.inactive, s.value(par) ) diff --git a/bindings/ruby/lib/cconfigspace/configuration.rb b/bindings/ruby/lib/cconfigspace/configuration.rb index d430d015..0dd48718 100644 --- a/bindings/ruby/lib/cconfigspace/configuration.rb +++ b/bindings/ruby/lib/cconfigspace/configuration.rb @@ -2,7 +2,6 @@ module CCS attach_function :ccs_create_configuration, [:ccs_configuration_space_t, :ccs_features_t, :size_t, :pointer, :pointer], :ccs_result_t attach_function :ccs_configuration_get_features, [:ccs_configuration_t, :pointer], :ccs_result_t - attach_function :ccs_configuration_check, [:ccs_configuration_t, :pointer], :ccs_result_t class Configuration < Binding alias configuration_space context @@ -32,13 +31,5 @@ def initialize(handle = nil, retain: false, auto_release: true, def self.from_handle(handle, retain: true, auto_release: true) self::new(handle, retain: retain, auto_release: auto_release) end - - def check - ptr = MemoryPointer::new(:ccs_bool_t) - CCS.error_check CCS.ccs_configuration_check(@handle, ptr) - return ptr.read_ccs_bool_t == CCS::FALSE ? false : true - end - end - end diff --git a/bindings/ruby/lib/cconfigspace/configuration_space.rb b/bindings/ruby/lib/cconfigspace/configuration_space.rb index abc69dd4..e75df605 100644 --- a/bindings/ruby/lib/cconfigspace/configuration_space.rb +++ b/bindings/ruby/lib/cconfigspace/configuration_space.rb @@ -6,7 +6,6 @@ module CCS attach_function :ccs_configuration_space_get_conditions, [:ccs_configuration_space_t, :size_t, :pointer, :pointer], :ccs_result_t attach_function :ccs_configuration_space_get_forbidden_clause, [:ccs_configuration_space_t, :size_t, :pointer], :ccs_result_t attach_function :ccs_configuration_space_get_forbidden_clauses, [:ccs_configuration_space_t, :size_t, :pointer, :pointer], :ccs_result_t - attach_function :ccs_configuration_space_check_configuration, [:ccs_configuration_space_t, :ccs_configuration_t, :pointer], :ccs_result_t attach_function :ccs_configuration_space_get_default_configuration, [:ccs_configuration_space_t, :ccs_features_t, :pointer], :ccs_result_t attach_function :ccs_configuration_space_sample, [:ccs_configuration_space_t, :ccs_distribution_space_t, :ccs_features_t, :ccs_rng_t, :pointer], :ccs_result_t attach_function :ccs_configuration_space_samples, [:ccs_configuration_space_t, :ccs_distribution_space_t, :ccs_features_t, :ccs_rng_t, :size_t, :pointer], :ccs_result_t @@ -106,12 +105,6 @@ def forbidden_clause(index) Expression.from_handle(ptr.read_ccs_expression_t) end - def check(configuration) - ptr = MemoryPointer::new(:ccs_bool_t) - CCS.error_check CCS.ccs_configuration_space_check_configuration(@handle, configuration.handle, ptr) - return ptr.read_ccs_bool_t == CCS::FALSE ? false : true - end - def default_configuration(features: nil) ptr = MemoryPointer::new(:ccs_configuration_t) CCS.error_check CCS.ccs_configuration_space_get_default_configuration(@handle, features, ptr) diff --git a/bindings/ruby/test/test_configuration_space.rb b/bindings/ruby/test/test_configuration_space.rb index 5e4fbba2..c135589a 100644 --- a/bindings/ruby/test/test_configuration_space.rb +++ b/bindings/ruby/test/test_configuration_space.rb @@ -18,14 +18,10 @@ def test_create assert_equal( h3, cs.parameter(2) ) assert_equal( [h1, h2, h3], cs.parameters ) assert_equal( h2, cs.parameter_by_name(h2.name) ) - assert( cs.check(cs.default_configuration) ) assert_nil( cs.feature_space ) c = cs.sample - assert( cs.check(c) ) assert_equal( cs.handle, c.configuration_space.handle ) - cs.samples(100).each { |c| - assert( cs.check(c) ) - } + cs.samples(100) end def test_set_distribution @@ -211,7 +207,6 @@ def test_omp 1000.times { s = cs.sample - assert( s.check ) active_params = extract_active_parameters(s.values) active_params.each { |par| refute_equal( CCS::Inactive, s.value(par) ) @@ -289,7 +284,6 @@ def test_omp_parse 1000.times { s = cs.sample - assert( s.check ) active_params = extract_active_parameters(s.values) active_params.each { |par| refute_equal( CCS::Inactive, s.value(par) ) @@ -305,7 +299,6 @@ def test_omp_parse cs_copy = CCS::deserialize(buffer: buff) 1000.times { s = cs_copy.sample - assert( s.check ) active_params = extract_active_parameters(s.values) active_params.each { |par| refute_equal( CCS::Inactive, s.value(par) ) diff --git a/include/cconfigspace/configuration.h b/include/cconfigspace/configuration.h index 62664556..8897fa3d 100644 --- a/include/cconfigspace/configuration.h +++ b/include/cconfigspace/configuration.h @@ -82,30 +82,6 @@ ccs_configuration_get_features( ccs_configuration_t configuration, ccs_features_t *features_ret); -/** - * Check that the configuration is a valid configuration for the configuration - * space. - * @param[in] configuration - * @param[out] is_valid_ret a pointer to a variable that will hold the result - * of the check. Result will be #CCS_TRUE if the - * configuration is valid. Result will be #CCS_FALSE - * if an active parameter value is not a valid value - * for this parameter; or if an inactive parameter - * value is not inactive; or if a forbidden clause - * would be evaluating to #ccs_true - * @return #CCS_RESULT_SUCCESS on success - * @return #CCS_RESULT_ERROR_INVALID_OBJECT if \p configuration is not a valid - * CCS configuration - * @return #CCS_RESULT_ERROR_INVALID_CONFIGURATION if \p configuration has - * become invalid for the configuration space - * @remarks - * This function is thread-safe - */ -extern ccs_result_t -ccs_configuration_check( - ccs_configuration_t configuration, - ccs_bool_t *is_valid_ret); - #ifdef __cplusplus } #endif diff --git a/include/cconfigspace/configuration_space.h b/include/cconfigspace/configuration_space.h index 602a8ce8..28d263f5 100644 --- a/include/cconfigspace/configuration_space.h +++ b/include/cconfigspace/configuration_space.h @@ -204,33 +204,6 @@ ccs_configuration_space_get_forbidden_clauses( ccs_expression_t *expressions, size_t *num_expressions_ret); -/** - * Check that a configuration is a valid in a configuration space. - * @param[in] configuration_space - * @param[in] configuration - * @param[out] is_valid_ret a pointer to a variable that will hold the result - * of the check. Result will be #CCS_TRUE if the - * configuration is valid. Result will be #CCS_FALSE - * if an active parameter value is not a valid value - * for this parameter; or if an inactive parameter - * value is not inactive; or if a forbidden clause - * would be evaluating to #ccs_true - * @return #CCS_RESULT_SUCCESS on success - * @return #CCS_RESULT_ERROR_INVALID_OBJECT if \p configuration_space is not a - * valid CCS configuration space; or if \p configuration is not a valid CCS - * configuration - * @return #CCS_RESULT_ERROR_INVALID_VALUE if \p is_valid_ret is NULL - * @return #CCS_RESULT_ERROR_INVALID_CONFIGURATION if \p configuration is not - * associated to the configuration space - * @remarks - * This function is thread-safe - */ -extern ccs_result_t -ccs_configuration_space_check_configuration( - ccs_configuration_space_t configuration_space, - ccs_configuration_t configuration, - ccs_bool_t *is_valid_ret); - /** * Get the default configuration of a configuration space * @param[in] configuration_space diff --git a/src/configuration.c b/src/configuration.c index 43c4369d..c6e2abfb 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -199,18 +199,22 @@ _ccs_create_configuration( config->data->num_bindings++; } if (values) { - memcpy(config->data->values, values, - num_parameters * sizeof(ccs_datum_t)); + ccs_bool_t is_valid; for (size_t i = 0; i < num_values; i++) - if (values[i].flags & CCS_DATUM_FLAG_TRANSIENT) - CCS_VALIDATE_ERR_GOTO( - err, - ccs_context_validate_value( - (ccs_context_t) - configuration_space, - i, values[i], - config->data->values + i), - errinit); + CCS_VALIDATE_ERR_GOTO( + err, + ccs_context_validate_value( + (ccs_context_t)configuration_space, i, + values[i], config->data->values + i), + errinit); + CCS_VALIDATE_ERR_GOTO( + err, + _check_configuration( + configuration_space, config, &is_valid), + errinit); + CCS_REFUTE_ERR_GOTO( + err, !is_valid, CCS_RESULT_ERROR_INVALID_VALUE, + errinit); } *configuration_ret = config; return CCS_RESULT_SUCCESS; @@ -269,15 +273,3 @@ ccs_configuration_get_features( *features_ret = configuration->data->features; return CCS_RESULT_SUCCESS; } - -ccs_result_t -ccs_configuration_check( - ccs_configuration_t configuration, - ccs_bool_t *is_valid_ret) -{ - CCS_CHECK_OBJ(configuration, CCS_OBJECT_TYPE_CONFIGURATION); - CCS_VALIDATE(ccs_configuration_space_check_configuration( - configuration->data->configuration_space, configuration, - is_valid_ret)); - return CCS_RESULT_SUCCESS; -} diff --git a/src/configuration_space.c b/src/configuration_space.c index c71b22d0..4076c5b6 100644 --- a/src/configuration_space.c +++ b/src/configuration_space.c @@ -725,90 +725,6 @@ ccs_configuration_space_get_default_configuration( return err; } -static ccs_result_t -_test_forbidden( - ccs_configuration_space_t configuration_space, - ccs_configuration_t configuration, - ccs_bool_t *is_valid) -{ - ccs_expression_t *forbidden_clauses = - configuration_space->data->forbidden_clauses; - *is_valid = CCS_FALSE; - for (size_t i = 0; i < configuration_space->data->num_forbidden_clauses; - i++) { - ccs_datum_t result; - CCS_VALIDATE(ccs_expression_eval( - forbidden_clauses[i], configuration->data->num_bindings, - configuration->data->bindings, &result)); - if (result.type == CCS_DATA_TYPE_INACTIVE) - continue; - if (result.type == CCS_DATA_TYPE_BOOL && - result.value.i == CCS_TRUE) - return CCS_RESULT_SUCCESS; - } - *is_valid = CCS_TRUE; - return CCS_RESULT_SUCCESS; -} - -static inline ccs_result_t -_check_configuration( - ccs_configuration_space_t configuration_space, - ccs_configuration_t configuration, - ccs_bool_t *is_valid_ret) -{ - size_t *indexes = configuration_space->data->sorted_indexes; - ccs_parameter_t *parameters = configuration_space->data->parameters; - ccs_expression_t *conditions = configuration_space->data->conditions; - ccs_datum_t *values = configuration->data->values; - - for (size_t i = 0; i < configuration_space->data->num_parameters; i++) { - ccs_bool_t active = CCS_TRUE; - size_t index = indexes[i]; - if (conditions[index]) { - ccs_datum_t result; - CCS_VALIDATE(ccs_expression_eval( - conditions[index], - configuration->data->num_bindings, - configuration->data->bindings, &result)); - if (!(result.type == CCS_DATA_TYPE_BOOL && - result.value.i == CCS_TRUE)) - active = CCS_FALSE; - } - if (active != (values[index].type == CCS_DATA_TYPE_INACTIVE ? - CCS_FALSE : - CCS_TRUE)) { - *is_valid_ret = CCS_FALSE; - return CCS_RESULT_SUCCESS; - } - if (active) { - CCS_VALIDATE(ccs_parameter_check_value( - parameters[index], values[index], - is_valid_ret)); - if (*is_valid_ret == CCS_FALSE) - return CCS_RESULT_SUCCESS; - } - } - CCS_VALIDATE(_test_forbidden( - configuration_space, configuration, is_valid_ret)); - return CCS_RESULT_SUCCESS; -} - -ccs_result_t -ccs_configuration_space_check_configuration( - ccs_configuration_space_t configuration_space, - ccs_configuration_t configuration, - ccs_bool_t *is_valid_ret) -{ - CCS_CHECK_OBJ(configuration_space, CCS_OBJECT_TYPE_CONFIGURATION_SPACE); - CCS_CHECK_OBJ(configuration, CCS_OBJECT_TYPE_CONFIGURATION); - CCS_REFUTE( - configuration->data->configuration_space != configuration_space, - CCS_RESULT_ERROR_INVALID_CONFIGURATION); - CCS_VALIDATE(_check_configuration( - configuration_space, configuration, is_valid_ret)); - return CCS_RESULT_SUCCESS; -} - static ccs_result_t _sample(ccs_configuration_space_t configuration_space, ccs_distribution_space_t distribution_space, diff --git a/src/configuration_space_internal.h b/src/configuration_space_internal.h index 433e5584..cbc2b009 100644 --- a/src/configuration_space_internal.h +++ b/src/configuration_space_internal.h @@ -38,4 +38,74 @@ struct _ccs_configuration_space_data_s { ccs_context_t contexts[2]; }; +#include "configuration_internal.h" + +static inline ccs_result_t +_test_forbidden( + ccs_configuration_space_t configuration_space, + ccs_configuration_t configuration, + ccs_bool_t *is_valid) +{ + ccs_expression_t *forbidden_clauses = + configuration_space->data->forbidden_clauses; + *is_valid = CCS_FALSE; + for (size_t i = 0; i < configuration_space->data->num_forbidden_clauses; + i++) { + ccs_datum_t result; + CCS_VALIDATE(ccs_expression_eval( + forbidden_clauses[i], configuration->data->num_bindings, + configuration->data->bindings, &result)); + if (result.type == CCS_DATA_TYPE_INACTIVE) + continue; + if (result.type == CCS_DATA_TYPE_BOOL && + result.value.i == CCS_TRUE) + return CCS_RESULT_SUCCESS; + } + *is_valid = CCS_TRUE; + return CCS_RESULT_SUCCESS; +} + +static inline ccs_result_t +_check_configuration( + ccs_configuration_space_t configuration_space, + ccs_configuration_t configuration, + ccs_bool_t *is_valid_ret) +{ + size_t *indexes = configuration_space->data->sorted_indexes; + ccs_parameter_t *parameters = configuration_space->data->parameters; + ccs_expression_t *conditions = configuration_space->data->conditions; + ccs_datum_t *values = configuration->data->values; + + for (size_t i = 0; i < configuration_space->data->num_parameters; i++) { + ccs_bool_t active = CCS_TRUE; + size_t index = indexes[i]; + if (conditions[index]) { + ccs_datum_t result; + CCS_VALIDATE(ccs_expression_eval( + conditions[index], + configuration->data->num_bindings, + configuration->data->bindings, &result)); + if (!(result.type == CCS_DATA_TYPE_BOOL && + result.value.i == CCS_TRUE)) + active = CCS_FALSE; + } + if (active != (values[index].type == CCS_DATA_TYPE_INACTIVE ? + CCS_FALSE : + CCS_TRUE)) { + *is_valid_ret = CCS_FALSE; + return CCS_RESULT_SUCCESS; + } + if (active) { + CCS_VALIDATE(ccs_parameter_check_value( + parameters[index], values[index], + is_valid_ret)); + if (*is_valid_ret == CCS_FALSE) + return CCS_RESULT_SUCCESS; + } + } + CCS_VALIDATE(_test_forbidden( + configuration_space, configuration, is_valid_ret)); + return CCS_RESULT_SUCCESS; +} + #endif //_CONFIGURATION_SPACE_INTERNAL_H diff --git a/tests/test_condition.c b/tests/test_condition.c index 805e88a7..f0abdf45 100644 --- a/tests/test_condition.c +++ b/tests/test_condition.c @@ -31,7 +31,6 @@ test_simple(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_configuration_space_sample( space, NULL, NULL, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); @@ -45,10 +44,6 @@ test_simple(void) assert(values[1].type == CCS_DATA_TYPE_FLOAT); else assert(values[1].type == CCS_DATA_TYPE_INACTIVE); - err = ccs_configuration_space_check_configuration( - space, configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configuration); assert(err == CCS_RESULT_SUCCESS); } @@ -59,7 +54,6 @@ test_simple(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 2, values, NULL); assert(err == CCS_RESULT_SUCCESS); @@ -70,10 +64,6 @@ test_simple(void) assert(values[1].type == CCS_DATA_TYPE_FLOAT); else assert(values[1].type == CCS_DATA_TYPE_INACTIVE); - err = ccs_configuration_space_check_configuration( - space, configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configurations[i]); assert(err == CCS_RESULT_SUCCESS); } @@ -124,7 +114,6 @@ test_transitive(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_configuration_space_sample( space, NULL, NULL, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); @@ -149,10 +138,6 @@ test_transitive(void) assert(values[2].type == CCS_DATA_TYPE_INACTIVE); assert(values[0].type == CCS_DATA_TYPE_INACTIVE); } - err = ccs_configuration_space_check_configuration( - space, configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configuration); assert(err == CCS_RESULT_SUCCESS); } @@ -163,7 +148,6 @@ test_transitive(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 3, values, NULL); assert(err == CCS_RESULT_SUCCESS); @@ -185,10 +169,6 @@ test_transitive(void) assert(values[2].type == CCS_DATA_TYPE_INACTIVE); assert(values[0].type == CCS_DATA_TYPE_INACTIVE); } - err = ccs_configuration_space_check_configuration( - space, configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configurations[i]); assert(err == CCS_RESULT_SUCCESS); } diff --git a/tests/test_configuration_space.c b/tests/test_configuration_space.c index fe1e79b8..dc16928b 100644 --- a/tests/test_configuration_space.c +++ b/tests/test_configuration_space.c @@ -35,7 +35,6 @@ check_configuration( ccs_parameter_t *parameters_ret = (ccs_parameter_t *)malloc(sizeof(ccs_parameter_t) * (sz + 1)); const char *name; - ccs_bool_t check; err = ccs_context_get_parameters( (ccs_context_t)configuration_space, 0, NULL, &sz_ret); @@ -75,9 +74,6 @@ check_configuration( configuration_space, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); - err = ccs_configuration_check(configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); for (size_t i = 0; i < sz; i++) { ccs_datum_t datum; ccs_datum_t hdatum; @@ -181,7 +177,6 @@ test_sample(void) ccs_configuration_t configurations[100]; ccs_configuration_space_t configuration_space; ccs_result_t err; - ccs_bool_t check; parameters[0] = create_dummy_parameter("param1"); parameters[1] = create_dummy_parameter("param2"); @@ -200,18 +195,11 @@ test_sample(void) configuration_space, NULL, NULL, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); - err = ccs_configuration_check(configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); - err = ccs_configuration_space_samples( configuration_space, NULL, NULL, NULL, 100, configurations); assert(err == CCS_RESULT_SUCCESS); for (size_t i = 0; i < 100; i++) { - err = ccs_configuration_check(configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configurations[i]); assert(err == CCS_RESULT_SUCCESS); } diff --git a/tests/test_distribution_space.c b/tests/test_distribution_space.c index 996b00c2..e655e7dc 100644 --- a/tests/test_distribution_space.c +++ b/tests/test_distribution_space.c @@ -35,7 +35,6 @@ check_configuration( ccs_parameter_t *parameters_ret = (ccs_parameter_t *)malloc(sizeof(ccs_parameter_t) * (sz + 1)); const char *name; - ccs_bool_t check; err = ccs_context_get_parameters( (ccs_context_t)configuration_space, 0, NULL, &sz_ret); @@ -75,9 +74,6 @@ check_configuration( configuration_space, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); - err = ccs_configuration_check(configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); for (size_t i = 0; i < sz; i++) { ccs_datum_t datum; ccs_datum_t hdatum; @@ -148,7 +144,6 @@ test_set_distribution(void) ccs_configuration_t configurations[100]; ccs_configuration_space_t configuration_space; ccs_result_t err; - ccs_bool_t check; parameters[0] = create_dummy_parameter("param1"); parameters[1] = create_dummy_parameter("param2"); @@ -201,9 +196,6 @@ test_set_distribution(void) for (size_t i = 0; i < 100; i++) { ccs_datum_t values[3]; - err = ccs_configuration_check(configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 3, values, NULL); assert(err == CCS_RESULT_SUCCESS); @@ -240,9 +232,6 @@ test_set_distribution(void) for (size_t i = 0; i < 100; i++) { ccs_datum_t values[3]; - err = ccs_configuration_check(configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 3, values, NULL); assert(err == CCS_RESULT_SUCCESS); diff --git a/tests/test_forbidden.c b/tests/test_forbidden.c index a378ac85..a8723b1a 100644 --- a/tests/test_forbidden.c +++ b/tests/test_forbidden.c @@ -30,7 +30,6 @@ test_simple(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_configuration_space_sample( space, NULL, NULL, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); @@ -43,10 +42,6 @@ test_simple(void) assert(values[1].type == CCS_DATA_TYPE_FLOAT); f = values[0].value.f; assert(f >= -1.0 && f < 1.0); - err = ccs_configuration_space_check_configuration( - space, configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configuration); assert(err == CCS_RESULT_SUCCESS); } @@ -56,7 +51,6 @@ test_simple(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 2, values, NULL); assert(err == CCS_RESULT_SUCCESS); @@ -66,10 +60,6 @@ test_simple(void) assert(values[1].type == CCS_DATA_TYPE_FLOAT); f = values[0].value.f; assert(f >= -1.0 && f < 1.0); - err = ccs_configuration_space_check_configuration( - space, configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configurations[i]); assert(err == CCS_RESULT_SUCCESS); } @@ -129,7 +119,6 @@ test_combined(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_configuration_space_sample( space, NULL, NULL, NULL, &configuration); assert(err == CCS_RESULT_SUCCESS); @@ -154,10 +143,6 @@ test_combined(void) assert(values[2].type == CCS_DATA_TYPE_INACTIVE); assert(values[0].type == CCS_DATA_TYPE_INACTIVE); } - err = ccs_configuration_space_check_configuration( - space, configuration, &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configuration); assert(err == CCS_RESULT_SUCCESS); } @@ -168,7 +153,6 @@ test_combined(void) for (int i = 0; i < 100; i++) { ccs_float_t f; - ccs_bool_t check; err = ccs_binding_get_values( (ccs_binding_t)configurations[i], 3, values, NULL); assert(err == CCS_RESULT_SUCCESS); @@ -190,10 +174,6 @@ test_combined(void) assert(values[2].type == CCS_DATA_TYPE_INACTIVE); assert(values[0].type == CCS_DATA_TYPE_INACTIVE); } - err = ccs_configuration_space_check_configuration( - space, configurations[i], &check); - assert(err == CCS_RESULT_SUCCESS); - assert(check); err = ccs_release_object(configurations[i]); assert(err == CCS_RESULT_SUCCESS); }