38 using namespace basis;
47 #define WHERE __WHERE__.s()
53 = registry_configurator::hkey_current_user;
57 #define LOG(s) program_wide_logger::get().log(s)
71 const char *TEST_NAME =
"zeroth test: cleaning section";
75 "section still exists after deleting!");
80 const char *TEST_NAME =
"first test: rectangle";
88 if (win_size != default_rectangle)
90 "rectangle not equal to default");
97 if (current_size != new_size)
99 "rectangle not equal to second size stored");
103 const char *TEST_NAME =
"second test: string";
104 astring junk(
"this is a junky string to be stored as bytes....");
107 byte_formatter::bytes_to_string(to_store, as_bytes);
113 byte_formatter::string_to_bytes(rettle, found_byte);
117 "registry_configurator load failed: default was used");
118 else if (found_junk != junk)
120 "registry_configurator load failed: result differed from original");
124 const char *TEST_NAME =
"third test: frunkle";
125 frunkle def_frunkle(3.14159265358);
130 if (found_frunkle ==
frunkle(9949494.3))
132 "registry_configurator load failed: default was used");
133 if (found_frunkle != def_frunkle)
135 "registry_configurator load failed: saved value differed");
139 const char *TEST_NAME =
"fourth test: frunkle";
140 frunkle def_frunkle(1487335673.1415926535834985987);
144 "frunkle_test",
"9949494.3");
146 if (found_frunkle ==
frunkle(9949494.3))
148 "registry_configurator load failed: wrong default was used");
149 if (found_frunkle != def_frunkle)
151 "registry_configurator load failed: saved value differed");
155 const char *TEST_NAME =
"fifth test: bytes";
157 astring junk(
"this is a junky string to be stored as bytes....");
160 byte_formatter::bytes_to_string(default_bytes, defbytes_string);
163 byte_formatter::string_to_bytes(tmp, found);
165 if (string_found == urp)
167 "registry_configurator load_bytes failed: default was used");
170 "registry_configurator load_bytes failed: array lengths differ");
171 if (string_found != junk)
173 "registry_configurator load_bytes failed: arrays differ");
177 const char *TEST_NAME =
"sixth test: blank string";
183 "with blank default failed: didn't return blank");
185 astring non_blank(
"blinkblankblunk");
187 if (fund != non_blank)
189 "with non-blank default failed: didn't return default");
191 if (fund != non_blank)
193 "with blank default failed: returned wrong string");
198 registry_configurator::AUTO_STORE);
199 const char *TEST_NAME =
"seventh test: get_section";
201 bool worked = ini.
get_section(
"Environment", sect);
209 const char *TEST_NAME =
"eighth test: put_section";
211 sect.add(
"dooby",
"mastiff");
212 sect.add(
"flammix",
"pontiff");
213 sect.add(
"gruntlix",
"sagawilla");
214 sect.add(
"toast",
"megaspoony");
const contents * observe() const
Returns a pointer to the underlying C array of data.
Provides a dynamically resizable ASCII character string.
int convert(int default_value) const
Converts the string into a corresponding integer.
int length() const
Returns the current length of the string.
virtual const char * observe() const
observes the underlying pointer to the zero-terminated string.
A very common template for a dynamic array of bytes.
bool store(const basis::astring §ion, const basis::astring &entry, const basis::astring &to_store)
a synonym for put.
basis::astring load(const basis::astring §ion, const basis::astring &entry, const basis::astring &default_value)
a synonym for get that implements the auto-store behavior.
Supports the configurator class interface on the windows registry.
virtual bool put_section(const basis::astring §ion, const structures::string_table &info)
writes a table called "info" into the "section" in the INI file.
virtual bool section_exists(const basis::astring §ion)
returns true if the "section" was found in the file.
virtual bool get_section(const basis::astring §ion, structures::string_table &info)
reads the entire "section" into a table called "info".
virtual bool delete_entry(const basis::astring §ion, const basis::astring &entry)
removes the entry specified by the "section" and "entry" name.
registry_hives
the hives are major partitions of the registry.
virtual bool delete_section(const basis::astring §ion)
removes the entire "section" specified.
basis::astring text_form() const
Prints out the contents of the rectangle.
bool from_text(const basis::astring &text)
Returns true if the "text" is parsed into this rectangle.
Represents a rectangle as interpreted on display screens.
double value() const
observes the value held in this.
#define deadly_error(c, f, i)
#define formal(parameter)
This macro just eats what it's passed; it marks unused formal parameters.
Provides macros that implement the 'main' program of an application.
The guards collection helps in testing preconditions and reporting errors.
Contains all of our objects for geometry and avoids name clashes.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
astring static_class_name()
const registry_configurator::registry_hives THE_HIVE
int main(int formal(argc), char *formal(argv)[])
const int test_iterations
const astring REGISTRY_SECTION