[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-commit
Subject:    [Gnash-commit] /srv/bzr/gnash/trunk r9541: Tom's avm2 patches
From:       Sandro Santilli <strk () keybit ! net>
Date:       2008-07-28 14:42:55
Message-ID: E1KNV9a-0003zl-9o () sv ! gnu ! org
[Download RAW message or body]

------------------------------------------------------------
revno: 9541
committer: Sandro Santilli <strk@keybit.net>
branch nick: trunk
timestamp: Mon 2008-07-28 16:42:55 +0200
message:
  Tom's avm2 patches
added:
  testsuite/libbase/string_tableTest.cpp
modified:
  libbase/string_table.cpp
  testsuite/libbase/Makefile.am
    ------------------------------------------------------------
    revno: 9538.1.1
    author: Tom Stellard <tstellar@gmail.com>
    committer: Sandro Santilli <strk@keybit.net>
    branch nick: avm2
    timestamp: Mon 2008-07-28 16:31:39 +0200
    message:
      Fix string_table::find() with insert_unfound=false, add unit test.
    modified:
      libbase/string_table.cpp
      testsuite/libbase/Makefile.am
    ------------------------------------------------------------
    revno: 9538.1.2
    author: Tom Stellard <tstellar@gmail.com>
    committer: Sandro Santilli <strk@keybit.net>
    branch nick: avm2
    timestamp: Mon 2008-07-28 16:32:27 +0200
    message:
      The unit test...
    added:
      testsuite/libbase/string_tableTest.cpp

["r9541.diff" (r9541.diff)]

=== modified file 'libbase/string_table.cpp'
--- a/libbase/string_table.cpp	2008-06-18 16:19:22 +0000
+++ b/libbase/string_table.cpp	2008-07-28 14:31:39 +0000
@@ -49,7 +49,7 @@
 	table::nth_index<0>::type::iterator i =
 		mTable.get<0>().find(*to_find);
 
-	if (i == mTable.end() && insert_unfound)
+	if (i == mTable.end())
 	{
 		if (insert_unfound)
 		{

=== modified file 'testsuite/libbase/Makefile.am'
--- a/testsuite/libbase/Makefile.am	2008-07-24 14:28:23 +0000
+++ b/testsuite/libbase/Makefile.am	2008-07-28 14:31:39 +0000
@@ -50,6 +50,7 @@
 	Point2dTest \
 	snappingrangetest \
 	Range2dTest \
+	string_tableTest \
 	$(NULL)
 
 #if CURL
@@ -81,6 +82,9 @@
 # LogTest_SOURCES = TCXXLog.cpp
 # LogTest_CPPFLAGS = '-DBUILDDIR="$(abs_builddir)"'
 
+string_tableTest_SOURCES = string_tableTest.cpp
+string_tableTest_CPPFLAGS = -DSRCDIR="$(srcdir)"
+
 TEST_DRIVERS = ../simple.exp
 TEST_CASES = \
         $(check_PROGRAMS) \

=== added file 'testsuite/libbase/string_tableTest.cpp'
--- a/testsuite/libbase/string_tableTest.cpp	1970-01-01 00:00:00 +0000
+++ b/testsuite/libbase/string_tableTest.cpp	2008-07-28 14:32:27 +0000
@@ -0,0 +1,53 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "string_table.h"
+#include "log.h"
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+#include <cmath>
+#include <string>
+
+#include "check.h"
+
+#include "utility.h"
+using namespace gnash;
+int
+main(int /*argc*/, char** /*argv*/)
+{
+	string_table testTable;
+	
+	LogFile& lgf = LogFile::getDefaultInstance();
+	lgf.setVerbosity(2);
+
+	testTable.insert("A");
+	testTable.insert("B");
+	testTable.insert("C");
+
+	check_equals(testTable.find("D",false),0);
+	check_equals(testTable.find("D"),4);
+	check_equals(testTable.find("A",false),1);
+	check_equals(testTable.find("B",false),2);
+	check_equals(testTable.find("C",false),3);
+	check_equals(testTable.find("D",false),4);
+}



_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic