]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
maintenance: remove testPreCompiler (#1628)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Sun, 7 Jan 2024 06:15:48 +0000 (06:15 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 7 Jan 2024 14:04:18 +0000 (14:04 +0000)
Precompilers are a very well established and tested technology,
remove this test which provides very little signal

compat/Makefile.am
compat/testPreCompiler.cc [deleted file]

index 0943b865699d69c2d11fb9086fbbcf9d4cfcc3a2..510eb24848b1b0c754d70f52251f91dfdd59c4ab 100644 (file)
@@ -87,11 +87,3 @@ libcompatsquid_la_SOURCES = \
        xstrto.h
 
 libcompatsquid_la_LIBADD= $(LTLIBOBJS)
-
-check_PROGRAMS += testPreCompiler
-TESTS += testPreCompiler
-
-testPreCompiler_SOURCES = \
-       testPreCompiler.cc
-testPreCompiler_LDADD= $(LIBCPPUNIT_LIBS)
-testPreCompiler_LDFLAGS=
diff --git a/compat/testPreCompiler.cc b/compat/testPreCompiler.cc
deleted file mode 100644 (file)
index a15e3c5..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#include "squid.h"
-#include "unitTestMain.h"
-
-#include <cassert>
-#include <cppunit/extensions/HelperMacros.h>
-
-/*
- * Test the pre-compiler directives used within Squid code actually work.
- */
-
-class TestPreCompiler : public CPPUNIT_NS::TestFixture
-{
-    CPPUNIT_TEST_SUITE(TestPreCompiler);
-    CPPUNIT_TEST(testIfDef);
-    CPPUNIT_TEST(testIfDefAnd);
-    CPPUNIT_TEST(testIfDefOr);
-    CPPUNIT_TEST_SUITE_END();
-
-protected:
-    void testIfDef();
-    void testIfDefAnd();
-    void testIfDefOr();
-};
-CPPUNIT_TEST_SUITE_REGISTRATION(TestPreCompiler);
-
-/**
- * Test several ways of defining pre-compiler directives.
- * Squid-3 uses #if FOO syntax for precompiler directives.
- * These tests ensure that the inputs will work as expected.
- */
-void
-TestPreCompiler::testIfDef()
-{
-    /* Defined to explicit value 1 should be true */
-#define ONE_FOO 1
-#if ONE_FOO
-    bool oneTrue = true;
-#else
-    bool oneTrue = false;
-#endif
-#if !ONE_FOO
-    bool oneFalse = true;
-#else
-    bool oneFalse = false;
-#endif
-    CPPUNIT_ASSERT(oneTrue);
-    CPPUNIT_ASSERT(!oneFalse);
-
-    /* Defined to explicit value 0 should be false */
-#define ZERO_FOO 0
-#if ZERO_FOO
-    bool zeroTrue = true;
-#else
-    bool zeroTrue = false;
-#endif
-#if !ZERO_FOO
-    bool zeroFalse = true;
-#else
-    bool zeroFalse = false;
-#endif
-    CPPUNIT_ASSERT(zeroFalse);
-    CPPUNIT_ASSERT(!zeroTrue);
-
-    /* Defined to exist without a value generates pre-compiler errors when used in #if . */
-
-    /* Not Defined to exist at all == false */
-#undef UNDEFINED_FOO
-#if UNDEFINED_FOO
-    bool undefinedTrue = true;
-#else
-    bool undefinedTrue = false;
-#endif
-#if !UNDEFINED_FOO
-    bool undefinedFalse = true;
-#else
-    bool undefinedFalse = false;
-#endif
-    CPPUNIT_ASSERT(undefinedFalse);
-    CPPUNIT_ASSERT(!undefinedTrue);
-}
-
-/**
- * Test several ways of defining pre-compiler directives.
- * Squid-3 uses #if FOO syntax for precompiler directives.
- * These tests ensure that the inputs will work as expected
- * when undefined macros are used in && conditions
- */
-void
-TestPreCompiler::testIfDefAnd()
-{
-    /* Not Defined to exist at all == false - when used in a compound if */
-#undef UNDEFINED_FOO
-#define ONE_FOO 1
-
-#if UNDEFINED_FOO && ONE_FOO
-    bool undefinedAndTrueA = true;
-#else
-    bool undefinedAndTrueA = false;
-#endif
-#if !UNDEFINED_FOO && ONE_FOO
-    bool undefinedAndFalseA = true;
-#else
-    bool undefinedAndFalseA = false;
-#endif
-    CPPUNIT_ASSERT(undefinedAndFalseA);
-    CPPUNIT_ASSERT(!undefinedAndTrueA);
-
-#if ONE_FOO && UNDEFINED_FOO
-    bool undefinedAndTrueB = true;
-#else
-    bool undefinedAndTrueB = false;
-#endif
-#if ONE_FOO && !UNDEFINED_FOO
-    bool undefinedAndFalseB = true;
-#else
-    bool undefinedAndFalseB = false;
-#endif
-    CPPUNIT_ASSERT(undefinedAndFalseB);
-    CPPUNIT_ASSERT(!undefinedAndTrueB);
-
-#if UNDEFINED_FOO && UNDEFINED_FOO
-    bool undefinedAndUndefinedC = true;
-#else
-    bool undefinedAndUndefinedC = false;
-#endif
-#if !UNDEFINED_FOO && !UNDEFINED_FOO
-    bool notUndefinedAndNotUndefinedC = true;
-#else
-    bool notUndefinedAndNotUndefinedC = false;
-#endif
-    CPPUNIT_ASSERT(!undefinedAndUndefinedC);
-    CPPUNIT_ASSERT(notUndefinedAndNotUndefinedC);
-}
-
-/**
- * Test several ways of defining pre-compiler directives.
- * Squid-3 uses #if FOO syntax for precompiler directives.
- * These tests ensure that the inputs will work as expected
- * when undefined macros are used in || conditions
- */
-void
-TestPreCompiler::testIfDefOr()
-{
-    /* Not Defined to exist at all == false - when used in a compound if */
-#undef UNDEFINED_FOO
-#define ZERO_FOO 0
-
-#if UNDEFINED_FOO || ZERO_FOO
-    bool undefinedOrTrueA = true;
-#else
-    bool undefinedOrTrueA = false;
-#endif
-#if !UNDEFINED_FOO || ZERO_FOO
-    bool undefinedOrFalseA = true;
-#else
-    bool undefinedOrFalseA = false;
-#endif
-    CPPUNIT_ASSERT(undefinedOrFalseA);
-    CPPUNIT_ASSERT(!undefinedOrTrueA);
-
-#if ZERO_FOO || UNDEFINED_FOO
-    bool undefinedOrTrueB = true;
-#else
-    bool undefinedOrTrueB = false;
-#endif
-#if ZERO_FOO || !UNDEFINED_FOO
-    bool undefinedOrFalseB = true;
-#else
-    bool undefinedOrFalseB = false;
-#endif
-    CPPUNIT_ASSERT(undefinedOrFalseB);
-    CPPUNIT_ASSERT(!undefinedOrTrueB);
-
-#if UNDEFINED_FOO || UNDEFINED_FOO
-    bool undefinedOrUndefinedC = true;
-#else
-    bool undefinedOrUndefinedC = false;
-#endif
-#if !UNDEFINED_FOO || !UNDEFINED_FOO
-    bool notUndefinedOrNotUndefinedC = true;
-#else
-    bool notUndefinedOrNotUndefinedC = false;
-#endif
-    CPPUNIT_ASSERT(notUndefinedOrNotUndefinedC);
-    CPPUNIT_ASSERT(!undefinedOrUndefinedC);
-}
-
-int
-main(int argc, char *argv[])
-{
-    return TestProgram().run(argc, argv);
-}
-