[Lemon-commits] [lemon_svn] klao: r494 - hugo/trunk/src/work/klao

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:39:44 CET 2006


Author: klao
Date: Wed Apr 21 21:10:59 2004
New Revision: 494

Modified:
   hugo/trunk/src/work/klao/iter_map_test.cc

Log:
Test for the new style iter

Modified: hugo/trunk/src/work/klao/iter_map_test.cc
==============================================================================
--- hugo/trunk/src/work/klao/iter_map_test.cc	(original)
+++ hugo/trunk/src/work/klao/iter_map_test.cc	Wed Apr 21 21:10:59 2004
@@ -26,6 +26,21 @@
   }
 }
 
+struct Int {
+  int a;
+
+  Int(int b = 5) : a(b) {}
+  Int(Invalid) : a(-1) {}
+
+  operator int() const { return a; }
+
+  bool valid() { return a != -1; }
+};
+
+typedef StdMap<Int,int> BaseMap2;
+typedef IterableBoolMap<BaseMap2> TestBoolMap2;
+
+
 int main() {
 
   {
@@ -179,4 +194,36 @@
     cout << " 42: " << test[42] << endl;
 
   }
+
+  {
+    cout << "\n\n\nTest a masikfele iteralasra:\n";
+
+    BaseMap2 base(344);
+    TestBoolMap2 test(base,false);
+
+    cout << "Inserting 12 to class true...\n";
+    test.insert(12,true);
+    print(test,2);
+
+    cout << "Inserting 22 to class true...\n";
+    test.insert(22,true);
+    print(test,2);
+
+    cout << "Inserting 10 to class false...\n";
+    test.insert(10,false);
+    print(test,2);
+
+    cout << "Testing some map values:\n";
+    cout << " 12: " << test[12] << endl;
+    cout << " 22: " << test[22] << endl;
+    cout << " 10: " << test[10] << endl;
+    cout << " 42: " << test[42] << endl;
+
+    cout << "The elements of the \"true\" class: ";
+    Int a;
+    for(test.first(a, true); a.valid(); test.next(a)) {
+      cout << " " << a;
+    }
+    cout << endl;
+  }
 }



More information about the Lemon-commits mailing list