Ported custom_gcode and print unit tests from Perl to C++.

This commit is contained in:
Vojtech Bubnik 2022-05-06 18:30:10 +02:00
parent 6ab517187f
commit e687db9eb0
10 changed files with 289 additions and 453 deletions

View file

@ -220,6 +220,16 @@ public:
config.set_deserialize_strict(items);
return config;
}
static DynamicPrintConfig new_with(const t_config_option_key &opt_key, const std::string &str, bool append = false) {
DynamicPrintConfig config;
config.set_deserialize_strict(opt_key, str, append);
return config;
}
static DynamicPrintConfig new_with(std::initializer_list<SetDeserializeItem> items) {
DynamicPrintConfig config;
config.set_deserialize_strict(items);
return config;
}
static DynamicPrintConfig* new_from_defaults_keys(const std::vector<std::string> &keys);
// Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
@ -1131,6 +1141,8 @@ public:
void set(const std::string &opt_key, T value) { m_data.set(opt_key, value, true); this->touch(); }
void set_deserialize(const t_config_option_key &opt_key, const std::string &str, ConfigSubstitutionContext &substitution_context, bool append = false)
{ m_data.set_deserialize(opt_key, str, substitution_context, append); this->touch(); }
void set_deserialize_strict(const t_config_option_key &opt_key, const std::string &str, bool append = false)
{ m_data.set_deserialize_strict(opt_key, str, append); this->touch(); }
bool erase(const t_config_option_key &opt_key) { bool out = m_data.erase(opt_key); if (out) this->touch(); return out; }
// Getters are thread safe.