1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
13 #include <anna/core/core.hpp>
21 const std::string& getName () const throw () { return a_name; }
28 static const std::string& value (const Object* oo) throw () { return oo->getName (); }
36 int len = 1 + rand () % 32;
39 for (ii = 0; ii < len; ii ++)
40 aux [ii] = char (rand () % 28 + 'A');
52 throw (RuntimeException)
54 typedef SortedVector <Object, SortByName, std::string> container;
55 typedef container::iterator iterator;
58 static const int MaxIndex = 64;
62 object = new Object* [MaxIndex];
64 for (int ii = 0; ii < MaxIndex; ii ++) {
65 object [ii] = new Object;
66 sorted.add (object [ii]);
69 for (iterator ii = sorted.begin (), maxii = sorted.end (); ii != maxii; ii ++)
70 cout << container::data (ii)->getName () << endl;
79 for (int loop = 0; loop < 1000; loop ++) {
80 for (int ii = 0; ii < MaxIndex; ii ++, counter ++) {
81 value = ((rand () % 100) > 50) ? object [ii]->getName (): generate ();
82 if (sorted.find (value) != NULL)
87 cout << "Counter: " << counter << " | Found: " << found << endl << endl;
90 int main (int argc, const char** argv)
93 Logger::setLevel (Logger::Debug);
94 Logger::initialize ("testfunctions", new TraceWriter ("file.trace", 2048000));
98 catch (Exception& ex) {
99 cout << ex.asString () << endl;