From 5a0e7b0ef494c091b584ea5b2caef8a98faaedfc Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sat, 22 Feb 2003 02:39:40 +0000 Subject: [PATCH] Remove tests with const template parameters. Should fix bustage on various ports. --- xpcom/tests/TestAutoPtr.cpp | 267 ++---------------------------------- 1 file changed, 10 insertions(+), 257 deletions(-) diff --git a/xpcom/tests/TestAutoPtr.cpp b/xpcom/tests/TestAutoPtr.cpp index 2db78ff65f6..7f4f25b3b80 100644 --- a/xpcom/tests/TestAutoPtr.cpp +++ b/xpcom/tests/TestAutoPtr.cpp @@ -55,15 +55,15 @@ class TestObject : public TestObjectBaseA, public TestObjectBaseB { class TestRefObjectBaseA { public: int fooA; - virtual void AddRef() const = 0; - virtual void Release() const = 0; + virtual void AddRef() = 0; + virtual void Release() = 0; }; class TestRefObjectBaseB { public: int fooB; - virtual void AddRef() const = 0; - virtual void Release() const = 0; + virtual void AddRef() = 0; + virtual void Release() = 0; }; class TestRefObject : public TestRefObjectBaseA, public TestRefObjectBaseB { @@ -81,21 +81,18 @@ class TestRefObject : public TestRefObjectBaseA, public TestRefObjectBaseB { NS_STATIC_CAST(void*, this)); } - // These are |const| as a test -- that's not the normal way of - // implementing |AddRef| and |Release|, but it's a possibility, - // so we should test it here. - void AddRef() const + void AddRef() { - ++NS_CONST_CAST(TestRefObject*, this)->mRefCount; + ++mRefCount; printf(" AddRef to %d on TestRefObject %p.\n", - mRefCount, NS_STATIC_CAST(const void*, this)); + mRefCount, NS_STATIC_CAST(void*, this)); } - void Release() const + void Release() { - --NS_CONST_CAST(TestRefObject*, this)->mRefCount; + --mRefCount; printf(" Release to %d on TestRefObject %p.\n", - mRefCount, NS_STATIC_CAST(const void*, this)); + mRefCount, NS_STATIC_CAST(void*, this)); if (mRefCount == 0) delete NS_CONST_CAST(TestRefObject*, this); } @@ -225,20 +222,6 @@ int main() ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); } - { - nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())) ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())) ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - { nsRefPtr p1( new TestRefObject() ); const nsRefPtr p2( p1 ); @@ -253,76 +236,6 @@ int main() ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); } - { - nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())) ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())) ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - const nsRefPtr p2( p1 ); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2)) ? "OK" : "broken"); - } - { nsRefPtr p1( new TestRefObject() ); TestRefObject * p2 = p1; @@ -337,20 +250,6 @@ int main() ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); } - { - nsRefPtr p1( new TestRefObject() ); - TestRefObject * p2 = NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - TestRefObject * p2 = NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - #if 0 /* MSVC++ 6.0 can't be coaxed to accept this */ { nsRefPtr p1( new TestRefObject() ); @@ -367,20 +266,6 @@ int main() } #endif /* Things that MSVC++ 6.0 can't be coaxed to accept */ - { - nsRefPtr p1( new TestRefObject() ); - TestRefObject * const p2 = NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - TestRefObject * const p2 = NS_CONST_CAST(TestRefObject*, NS_STATIC_CAST(const TestRefObject*, p1.get())); - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - { nsRefPtr p1( new TestRefObject() ); const TestRefObject * p2 = p1; @@ -395,20 +280,6 @@ int main() ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); } - { - nsRefPtr p1( new TestRefObject() ); - const TestRefObject * p2 = p1; - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - const TestRefObject * p2 = p1; - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - { nsRefPtr p1( new TestRefObject() ); const TestRefObject * const p2 = p1; @@ -423,20 +294,6 @@ int main() ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); } - { - nsRefPtr p1( new TestRefObject() ); - const TestRefObject * const p2 = p1; - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - - { - const nsRefPtr p1( new TestRefObject() ); - const TestRefObject * const p2 = p1; - printf("equality %s.\n", - ((p1 == p2) && !(p1 != p2) && (p2 == p1) && !(p2 != p1)) ? "OK" : "broken"); - } - printf("\nTesting getter_Transfers and getter_AddRefs.\n"); { @@ -613,58 +470,6 @@ int main() printf("Should Release and destroy one |TestRefObject|:\n"); } - { - printf("Should create one |TestObject|:\n"); - nsAutoPtr pobj(new TestObject()); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(pobj); - printf("Should destroy one |TestObject|:\n"); - } - - { - printf("Should create 3 |TestObject|s:\n"); - nsAutoArrayPtr pobj(new TestObject[3]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(&pobj[1]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(pobj + 1); - printf("Should destroy 3 |TestObject|s:\n"); - } - - { - printf("Should create and AddRef one |TestRefObject|:\n"); - nsRefPtr pobj = new TestRefObject(); - printf("Should do something with one |TestRefObject|:\n"); - DoSomethingWithConstTestRefObject(pobj); - printf("Should Release and destroy one |TestRefObject|:\n"); - } - - { - printf("Should create one |TestObject|:\n"); - nsAutoPtr pobj(new TestObject()); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(pobj); - printf("Should destroy one |TestObject|:\n"); - } - - { - printf("Should create 3 |TestObject|s:\n"); - nsAutoArrayPtr pobj(new TestObject[3]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(&pobj[1]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(pobj + 1); - printf("Should destroy 3 |TestObject|s:\n"); - } - - { - printf("Should create and AddRef one |TestRefObject|:\n"); - nsRefPtr pobj = new TestRefObject(); - printf("Should do something with one |TestRefObject|:\n"); - DoSomethingWithConstTestRefObjectBaseB(pobj); - printf("Should Release and destroy one |TestRefObject|:\n"); - } - { printf("Should create one |TestObject|:\n"); const nsAutoPtr pobj(new TestObject()); @@ -733,57 +538,5 @@ int main() printf("Should Release and destroy one |TestRefObject|:\n"); } - { - printf("Should create one |TestObject|:\n"); - const nsAutoPtr pobj(new TestObject()); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(pobj); - printf("Should destroy one |TestObject|:\n"); - } - - { - printf("Should create 3 |TestObject|s:\n"); - const nsAutoArrayPtr pobj(new TestObject[3]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(&pobj[1]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObject(pobj + 1); - printf("Should destroy 3 |TestObject|s:\n"); - } - - { - printf("Should create and AddRef one |TestRefObject|:\n"); - const nsRefPtr pobj = new TestRefObject(); - printf("Should do something with one |TestRefObject|:\n"); - DoSomethingWithConstTestRefObject(pobj); - printf("Should Release and destroy one |TestRefObject|:\n"); - } - - { - printf("Should create one |TestObject|:\n"); - const nsAutoPtr pobj(new TestObject()); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(pobj); - printf("Should destroy one |TestObject|:\n"); - } - - { - printf("Should create 3 |TestObject|s:\n"); - const nsAutoArrayPtr pobj(new TestObject[3]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(&pobj[1]); - printf("Should do something with one |TestObject|:\n"); - DoSomethingWithConstTestObjectBaseB(pobj + 1); - printf("Should destroy 3 |TestObject|s:\n"); - } - - { - printf("Should create and AddRef one |TestRefObject|:\n"); - const nsRefPtr pobj = new TestRefObject(); - printf("Should do something with one |TestRefObject|:\n"); - DoSomethingWithConstTestRefObjectBaseB(pobj); - printf("Should Release and destroy one |TestRefObject|:\n"); - } - return 0; }