gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog testsuite/libbase/Makefile.am t...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/libbase/Makefile.am t...
Date: Wed, 08 Nov 2006 09:18:29 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/08 09:18:29

Modified files:
        .              : ChangeLog 
        testsuite/libbase: Makefile.am 
Added files:
        testsuite/libbase: smart_ptrTest.cpp 

Log message:
                * testsuite/libbase/: Makefile.am, smart_ptrTest.cpp:
                  added unit test for smart_ptr<>.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1554&r2=1.1555
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/Makefile.am?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/smart_ptrTest.cpp?cvsroot=gnash&rev=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1554
retrieving revision 1.1555
diff -u -b -r1.1554 -r1.1555
--- ChangeLog   8 Nov 2006 09:16:17 -0000       1.1554
+++ ChangeLog   8 Nov 2006 09:18:29 -0000       1.1555
@@ -1,5 +1,7 @@
 2006-11-08 Sandro Santilli <address@hidden>
 
+       * testsuite/libbase/: Makefile.am, smart_ptrTest.cpp:
+         added unit test for smart_ptr<>. 
        * configure.ac: move the AC_DEFINE([GUI_*]) calls *after*
          the possible fallback to SDL (see bug #15540)
        * server/: array.cpp, as_function.cpp, asobj/: MovieClip.cpp,

Index: testsuite/libbase/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libbase/Makefile.am,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- testsuite/libbase/Makefile.am       29 Oct 2006 18:34:18 -0000      1.20
+++ testsuite/libbase/Makefile.am       8 Nov 2006 09:18:29 -0000       1.21
@@ -41,6 +41,7 @@
        CurlStreamTest  \
        NoSeekFileTest \
        URLTest \
+       smart_ptrTest \
        RcTest
 
 CLEANFILES = \
@@ -65,6 +66,9 @@
 URLTest_SOURCES = URLTest.cpp
 URLTest_CPPFLAGS = '-DBUILDDIR="$(abs_builddir)"'
 
+smart_ptrTest_SOURCES = smart_ptrTest.cpp
+smart_ptrTest_CPPFLAGS = '-DBUILDDIR="$(abs_builddir)"'
+
 RcTest_SOURCES = TCXXRc.cpp
 RcTest_CPPFLAGS = -DSRCDIR="$(srcdir)"
 

Index: testsuite/libbase/smart_ptrTest.cpp
===================================================================
RCS file: testsuite/libbase/smart_ptrTest.cpp
diff -N testsuite/libbase/smart_ptrTest.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/libbase/smart_ptrTest.cpp 8 Nov 2006 09:18:29 -0000       1.2
@@ -0,0 +1,71 @@
+// 
+//   Copyright (C) 2005, 2006 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 2 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 "config.h"
+#endif
+
+#include "check.h"
+#include "smart_ptr.h"
+#include "ref_counted.h"
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+using namespace std;
+using namespace gnash;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+       ref_counted* obj = new ref_counted();
+       check_equals(obj->get_ref_count(), 0);
+
+       smart_ptr<ref_counted> ptr1(obj);
+       check_equals(obj->get_ref_count(), 1);
+
+       smart_ptr<ref_counted> ptr2(obj);
+       check_equals(obj->get_ref_count(), 2);
+
+       smart_ptr<ref_counted> ptr3(ptr1);
+       check_equals(obj->get_ref_count(), 3);
+
+       smart_ptr<ref_counted> ptr4(ptr2.get_ptr());
+       check_equals(obj->get_ref_count(), 4);
+
+       ptr1 = ptr3;
+       check_equals(obj->get_ref_count(), 4);
+
+       ptr1 = ptr3.get_ptr();
+       check_equals(obj->get_ref_count(), 4);
+
+       smart_ptr<ref_counted> ptr5;
+       ptr5 = ptr3;
+       check_equals(obj->get_ref_count(), 5);
+
+       {
+               smart_ptr<ref_counted> ptr6(obj);
+               check_equals(obj->get_ref_count(), 6);
+               smart_ptr<ref_counted> ptr7(ptr6);
+               check_equals(obj->get_ref_count(), 7);
+               smart_ptr<ref_counted> ptr8(ptr7);
+               check_equals(obj->get_ref_count(), 8);
+       }
+
+       check_equals(obj->get_ref_count(), 5);
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]