[Aptitude-svn-commit] r4027 - in branches/aptitude-0.3/aptitude: . tests

Daniel Burrows dburrows at costa.debian.org
Wed Aug 31 22:45:59 UTC 2005


Author: dburrows
Date: Wed Aug 31 22:45:57 2005
New Revision: 4027

Added:
   branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc
Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/tests/   (props changed)
   branches/aptitude-0.3/aptitude/tests/Makefile.am
Log:
Add a simple interactive set tester.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 31 22:45:57 2005
@@ -1,5 +1,9 @@
 2005-08-31  Daniel Burrows  <dburrows at debian.org>
 
+	* tests/Makefile.am, tests/interactive_set_test.cc:
+
+	  Add a simple interactive test for the set code.
+
 	* src/generic/immset.h:
 
 	  Yet another silly error from moving the code: use getRight, not

Modified: branches/aptitude-0.3/aptitude/tests/Makefile.am
==============================================================================
--- branches/aptitude-0.3/aptitude/tests/Makefile.am	(original)
+++ branches/aptitude-0.3/aptitude/tests/Makefile.am	Wed Aug 31 22:45:57 2005
@@ -5,10 +5,14 @@
 
 check_PROGRAMS = test
 
+noinst_PROGRAMS = interactive_set_test
+
 TESTS = test
 
 EXTRADIST = data
 
+interactive_set_test_SOURCES = interactive_set_test.cc
+
 # Note: test_apt_universe is not built by default because it takes way
 # too long.  Of course, ideally this would be done in a less ad-hoc
 # way...

Added: branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc
==============================================================================
--- (empty file)
+++ branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc	Wed Aug 31 22:45:57 2005
@@ -0,0 +1,36 @@
+// A simple test that allows you to interactively build sets.
+
+#include <src/generic/immset.h>
+
+#include <iostream>
+
+int main(int argc, char **argv)
+{
+  imm::set<int> s;
+
+  while(!std::cin.eof())
+    {
+      std::string str;
+      int i;
+
+      std::cin >> str >> i;
+
+      if(std::cin)
+	{
+	  if(str == "+")
+	    {
+	      s.insert(i);
+	      std::cout << s << std::endl;
+	    }
+	  else if(str == "-")
+	    {
+	      s.erase(i);
+	      std::cout << s << std::endl;
+	    }
+	  else
+	    std::cerr << "Enter '+' or '-' followed by a number." << std::endl;
+	}
+    }
+
+  return 0;
+}



More information about the Aptitude-svn-commit mailing list