diff --git a/src/V3Control.cpp b/src/V3Control.cpp index 2b6d9c262..f3cac1352 100644 --- a/src/V3Control.cpp +++ b/src/V3Control.cpp @@ -491,41 +491,41 @@ public: IgnIndices results; int nextChange = 0; tree.find(0, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 0); - UASSERT_SELFTEST(const int, nextChange, 10); + UASSERT_SELFTEST(results.size(), 0); + UASSERT_SELFTEST(nextChange, 10); tree.find(10, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 2); - UASSERT_SELFTEST(const int, results[0], 0); - UASSERT_SELFTEST(const int, results[1], 3); - UASSERT_SELFTEST(const int, nextChange, 11); + UASSERT_SELFTEST(results.size(), 2); + UASSERT_SELFTEST(results[0], 0); + UASSERT_SELFTEST(results[1], 3); + UASSERT_SELFTEST(nextChange, 11); tree.find(11, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 1); - UASSERT_SELFTEST(const int, results[0], 3); - UASSERT_SELFTEST(const int, nextChange, 15); // Center, or would be 20 + UASSERT_SELFTEST(results.size(), 1); + UASSERT_SELFTEST(results[0], 3); + UASSERT_SELFTEST(nextChange, 15); // Center, or would be 20 tree.find(20, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 3); - UASSERT_SELFTEST(const int, results[0], 1); - UASSERT_SELFTEST(const int, results[1], 3); - UASSERT_SELFTEST(const int, results[2], 4); - UASSERT_SELFTEST(const int, nextChange, 21); + UASSERT_SELFTEST(results.size(), 3); + UASSERT_SELFTEST(results[0], 1); + UASSERT_SELFTEST(results[1], 3); + UASSERT_SELFTEST(results[2], 4); + UASSERT_SELFTEST(nextChange, 21); tree.find(21, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 2); - UASSERT_SELFTEST(const int, results[0], 3); - UASSERT_SELFTEST(const int, results[1], 4); - UASSERT_SELFTEST(const int, nextChange, 25); // Center, or would be 30 + UASSERT_SELFTEST(results.size(), 2); + UASSERT_SELFTEST(results[0], 3); + UASSERT_SELFTEST(results[1], 4); + UASSERT_SELFTEST(nextChange, 25); // Center, or would be 30 tree.find(30, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 2); - UASSERT_SELFTEST(const int, results[0], 3); - UASSERT_SELFTEST(const int, results[1], 4); - UASSERT_SELFTEST(const int, nextChange, 31); + UASSERT_SELFTEST(results.size(), 2); + UASSERT_SELFTEST(results[0], 3); + UASSERT_SELFTEST(results[1], 4); + UASSERT_SELFTEST(nextChange, 31); tree.find(40, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 2); - UASSERT_SELFTEST(const int, results[0], 2); - UASSERT_SELFTEST(const int, results[1], 4); - UASSERT_SELFTEST(const int, nextChange, 41); + UASSERT_SELFTEST(results.size(), 2); + UASSERT_SELFTEST(results[0], 2); + UASSERT_SELFTEST(results[1], 4); + UASSERT_SELFTEST(nextChange, 41); tree.find(41, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 0); - UASSERT_SELFTEST(const int, nextChange, std::numeric_limits::max()); + UASSERT_SELFTEST(results.size(), 0); + UASSERT_SELFTEST(nextChange, std::numeric_limits::max()); // points = {{0, 0}}; for (const auto& it : points) { @@ -536,8 +536,8 @@ public: tree.build(data); // tree.find(50, results, nextChange); - UASSERT_SELFTEST(const size_t, results.size(), 1); - UASSERT_SELFTEST(const int, results[0], 5); + UASSERT_SELFTEST(results.size(), 1); + UASSERT_SELFTEST(results[0], 5); } }; diff --git a/src/V3Error.h b/src/V3Error.h index f88ecd77f..35f19c046 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -783,11 +783,10 @@ void v3errorEndFatal(std::ostringstream& sstr) } \ } while (false) /// Check self test values for expected value. Safe from side-effects. -// Type argument can be removed when go to C++11 (use auto). -#define UASSERT_SELFTEST(Type, got, exp) \ +#define UASSERT_SELFTEST(got, exp) \ do { \ - Type g = (got); \ - Type e = (exp); \ + const auto g = (got); \ + const decltype(g) e{exp}; \ UASSERT(g == e, "Self-test failed '" #got "==" #exp "'" \ " got=" \ << g << " expected=" << e); \ diff --git a/src/V3ExecGraph.cpp b/src/V3ExecGraph.cpp index 1129360a0..bf3d18821 100644 --- a/src/V3ExecGraph.cpp +++ b/src/V3ExecGraph.cpp @@ -596,76 +596,76 @@ public: 10}; // Sandbag denom const std::vector scheduled = packer.pack(graph); - UASSERT_SELFTEST(const size_t, scheduled.size(), 3); - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads.size(), threads); - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads[0].size(), 2); + UASSERT_SELFTEST(scheduled.size(), 3); + UASSERT_SELFTEST(scheduled[0].m_threads.size(), threads); + UASSERT_SELFTEST(scheduled[0].m_threads[0].size(), 2); for (size_t i = 1; i < scheduled[0].m_threads.size(); ++i) - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads[i].size(), 0); + UASSERT_SELFTEST(scheduled[0].m_threads[i].size(), 0); - UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][0], t0); - UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][1], t1); + UASSERT_SELFTEST(scheduled[0].m_threads[0][0], t0); + UASSERT_SELFTEST(scheduled[0].m_threads[0][1], t1); - UASSERT_SELFTEST(const size_t, scheduled[1].m_threads.size(), hierThreads / 3); - UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][0], t2); - UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][1], t3); - UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[1][0], t4); + UASSERT_SELFTEST(scheduled[1].m_threads.size(), hierThreads / 3); + UASSERT_SELFTEST(scheduled[1].m_threads[0][0], t2); + UASSERT_SELFTEST(scheduled[1].m_threads[0][1], t3); + UASSERT_SELFTEST(scheduled[1].m_threads[1][0], t4); - UASSERT_SELFTEST(const size_t, scheduled[2].m_threads.size(), threads); - UASSERT_SELFTEST(const ExecMTask*, scheduled[2].m_threads[0][0], t5); - UASSERT_SELFTEST(const ExecMTask*, scheduled[2].m_threads[1][0], t6); + UASSERT_SELFTEST(scheduled[2].m_threads.size(), threads); + UASSERT_SELFTEST(scheduled[2].m_threads[0][0], t5); + UASSERT_SELFTEST(scheduled[2].m_threads[1][0], t6); - UASSERT_SELFTEST(const size_t, ThreadSchedule::s_mtaskState.size(), 7); + UASSERT_SELFTEST(ThreadSchedule::s_mtaskState.size(), 7); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t0), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t1), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t2), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t3), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t4), 1); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t5), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t6), 1); + UASSERT_SELFTEST(ThreadSchedule::threadId(t0), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t1), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t2), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t3), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t4), 1); + UASSERT_SELFTEST(ThreadSchedule::threadId(t5), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t6), 1); // On its native thread, we see the actual end time for t0: - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t0, 0), 1000); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t0, 0), 1000); // On the other thread, we see a sandbagged end time which does not // exceed the t1 end time: - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t0, 1), 1099); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t0, 1), 1099); // Actual end time on native thread: - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t1, 0), 1100); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t1, 0), 1100); // Sandbagged end time seen on thread 1. Note it does not compound // with t0's sandbagged time; compounding caused trouble in // practice. - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t1, 1), 1130); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t1, 1), 1130); // Wide task scheduling // Task does not depend on previous or future schedules - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t2, 0), 0); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[2], t2, 0), 0); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t2, 0), 0); + UASSERT_SELFTEST(packer.completionTime(scheduled[2], t2, 0), 0); // We allow sandbagging for hierarchical children tasks, this does not affect // wide task scheduling. When the next schedule is created it doesn't matter // anyway. - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 0), 1200); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 1), 1230); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 2), 1230); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 3), 1230); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 4), 1230); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t2, 5), 1230); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 0), 1200); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 1), 1230); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 2), 1230); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 3), 1230); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 4), 1230); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t2, 5), 1230); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 0), 1300); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 1), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 2), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 3), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 4), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t3, 5), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 0), 1300); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 1), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 2), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 3), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 4), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t3, 5), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 0), 1360); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 1), 1330); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 2), 1360); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 3), 1360); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 4), 1360); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t4, 5), 1360); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 0), 1360); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 1), 1330); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 2), 1360); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 3), 1360); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 4), 1360); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t4, 5), 1360); for (V3GraphVertex& vtx : graph.vertices()) vtx.as()->funcp()->deleteTree(); VL_DO_DANGLING(execGraphp->deleteTree(), execGraphp); @@ -698,29 +698,29 @@ public: 10}; // Sandbag denom const std::vector scheduled = packer.pack(graph); - UASSERT_SELFTEST(const size_t, scheduled.size(), 2); - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads.size(), hierThreads / 2); - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads[0].size(), 1); + UASSERT_SELFTEST(scheduled.size(), 2); + UASSERT_SELFTEST(scheduled[0].m_threads.size(), hierThreads / 2); + UASSERT_SELFTEST(scheduled[0].m_threads[0].size(), 1); for (size_t i = 1; i < scheduled[0].m_threads.size(); ++i) - UASSERT_SELFTEST(const size_t, scheduled[0].m_threads[i].size(), 0); + UASSERT_SELFTEST(scheduled[0].m_threads[i].size(), 0); - UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][0], t0); + UASSERT_SELFTEST(scheduled[0].m_threads[0][0], t0); - UASSERT_SELFTEST(const size_t, scheduled[1].m_threads.size(), threads); - UASSERT_SELFTEST(const size_t, scheduled[1].m_threads[0].size(), 1); + UASSERT_SELFTEST(scheduled[1].m_threads.size(), threads); + UASSERT_SELFTEST(scheduled[1].m_threads[0].size(), 1); for (size_t i = 1; i < scheduled[1].m_threads.size(); ++i) - UASSERT_SELFTEST(const size_t, scheduled[1].m_threads[i].size(), 0); - UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][0], t1); + UASSERT_SELFTEST(scheduled[1].m_threads[i].size(), 0); + UASSERT_SELFTEST(scheduled[1].m_threads[0][0], t1); - UASSERT_SELFTEST(const size_t, ThreadSchedule::s_mtaskState.size(), 2); + UASSERT_SELFTEST(ThreadSchedule::s_mtaskState.size(), 2); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t0), 0); - UASSERT_SELFTEST(const uint32_t, ThreadSchedule::threadId(t1), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t0), 0); + UASSERT_SELFTEST(ThreadSchedule::threadId(t1), 0); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[0], t0, 0), 1000); + UASSERT_SELFTEST(packer.completionTime(scheduled[0], t0, 0), 1000); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t1, 0), 1100); - UASSERT_SELFTEST(const uint32_t, packer.completionTime(scheduled[1], t1, 1), 1130); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t1, 0), 1100); + UASSERT_SELFTEST(packer.completionTime(scheduled[1], t1, 1), 1130); for (V3GraphVertex& vtx : graph.vertices()) vtx.as()->funcp()->deleteTree(); VL_DO_DANGLING(execGraphp->deleteTree(), execGraphp); @@ -1200,12 +1200,12 @@ void selfTest() { {2, {20, 0}}, // Note no profile {3, {30, 3000}}}); normalizeCosts(costs); - UASSERT_SELFTEST(const uint64_t, costs[1].first, 1000); - UASSERT_SELFTEST(const uint64_t, costs[1].second, 1000); - UASSERT_SELFTEST(const uint64_t, costs[2].first, 2000); - UASSERT_SELFTEST(const uint64_t, costs[2].second, 0); - UASSERT_SELFTEST(const uint64_t, costs[3].first, 3000); - UASSERT_SELFTEST(const uint64_t, costs[3].second, 3000); + UASSERT_SELFTEST(costs[1].first, 1000); + UASSERT_SELFTEST(costs[1].second, 1000); + UASSERT_SELFTEST(costs[2].first, 2000); + UASSERT_SELFTEST(costs[2].second, 0); + UASSERT_SELFTEST(costs[3].first, 3000); + UASSERT_SELFTEST(costs[3].second, 3000); } { // Test that very large profile data properly scales Costs costs({// id est prof @@ -1213,12 +1213,12 @@ void selfTest() { {2, {20, 200000000000}}, {3, {30, 1}}}); // Make sure doesn't underflow normalizeCosts(costs); - UASSERT_SELFTEST(const uint64_t, costs[1].first, 2500000); - UASSERT_SELFTEST(const uint64_t, costs[1].second, 5000000); - UASSERT_SELFTEST(const uint64_t, costs[2].first, 5000000); - UASSERT_SELFTEST(const uint64_t, costs[2].second, 10000000); - UASSERT_SELFTEST(const uint64_t, costs[3].first, 7500000); - UASSERT_SELFTEST(const uint64_t, costs[3].second, 1); + UASSERT_SELFTEST(costs[1].first, 2500000); + UASSERT_SELFTEST(costs[1].second, 5000000); + UASSERT_SELFTEST(costs[2].first, 5000000); + UASSERT_SELFTEST(costs[2].second, 10000000); + UASSERT_SELFTEST(costs[3].first, 7500000); + UASSERT_SELFTEST(costs[3].second, 1); } PackThreads::selfTest(); diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 62d0a60c4..db5093237 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -2744,24 +2744,22 @@ void V3Number::selfTest() { void V3Number::selfTestThis() { // The self test has a "this" so UASSERT_SELFTEST/errorEndFatal works correctly - UASSERT_SELFTEST(const bool, V3Number::epsilonEqual(0, 0), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonEqual(1e19, 1e19), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonEqual(9, 0.0001), false); - UASSERT_SELFTEST(const bool, - V3Number::epsilonEqual(1, 1 + std::numeric_limits::epsilon()), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonEqual(0.009, 0.00899999999999999931998839741709), - true); + UASSERT_SELFTEST(V3Number::epsilonEqual(0, 0), true); + UASSERT_SELFTEST(V3Number::epsilonEqual(1e19, 1e19), true); + UASSERT_SELFTEST(V3Number::epsilonEqual(9, 0.0001), false); + UASSERT_SELFTEST(V3Number::epsilonEqual(1, 1 + std::numeric_limits::epsilon()), true); + UASSERT_SELFTEST(V3Number::epsilonEqual(0.009, 0.00899999999999999931998839741709), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(0), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(1), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(-1), true); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(1.0001), false); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(0.9999), false); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(-1.0001), false); - UASSERT_SELFTEST(const bool, V3Number::epsilonIntegral(-0.9999), false); + UASSERT_SELFTEST(V3Number::epsilonIntegral(0), true); + UASSERT_SELFTEST(V3Number::epsilonIntegral(1), true); + UASSERT_SELFTEST(V3Number::epsilonIntegral(-1), true); + UASSERT_SELFTEST(V3Number::epsilonIntegral(1.0001), false); + UASSERT_SELFTEST(V3Number::epsilonIntegral(0.9999), false); + UASSERT_SELFTEST(V3Number::epsilonIntegral(-1.0001), false); + UASSERT_SELFTEST(V3Number::epsilonIntegral(-0.9999), false); - UASSERT_SELFTEST(const int, log2b(0), 0); - UASSERT_SELFTEST(const int, log2b(1), 0); - UASSERT_SELFTEST(const int, log2b(0x40000000UL), 30); - UASSERT_SELFTEST(const int, log2bQuad(0x4000000000000000ULL), 62); + UASSERT_SELFTEST(log2b(0), 0); + UASSERT_SELFTEST(log2b(1), 0); + UASSERT_SELFTEST(log2b(0x40000000UL), 30); + UASSERT_SELFTEST(log2bQuad(0x4000000000000000ULL), 62); } diff --git a/src/V3Os.cpp b/src/V3Os.cpp index 62e262779..5ce4c9791 100644 --- a/src/V3Os.cpp +++ b/src/V3Os.cpp @@ -522,42 +522,42 @@ int V3Os::system(const string& command) { void V3Os::selfTest() { #ifdef VL_DEBUG - UASSERT_SELFTEST(const string, filenameCleanup(""), ""); - UASSERT_SELFTEST(const string, filenameCleanup("."), "."); - UASSERT_SELFTEST(const string, filenameCleanup(".."), ".."); - UASSERT_SELFTEST(const string, filenameCleanup("/"), "/"); - UASSERT_SELFTEST(const string, filenameCleanup("../"), ".."); - UASSERT_SELFTEST(const string, filenameCleanup("//"), "/"); - UASSERT_SELFTEST(const string, filenameCleanup("//."), "/."); - UASSERT_SELFTEST(const string, filenameCleanup("./"), "."); - UASSERT_SELFTEST(const string, filenameCleanup("././"), "."); - UASSERT_SELFTEST(const string, filenameCleanup(".///"), "."); - UASSERT_SELFTEST(const string, filenameCleanup("a"), "a"); - UASSERT_SELFTEST(const string, filenameCleanup("a/"), "a"); - UASSERT_SELFTEST(const string, filenameCleanup("a/b"), "a/b"); - UASSERT_SELFTEST(const string, filenameCleanup("././//./a/b"), "a/b"); - UASSERT_SELFTEST(const string, filenameCleanup(".//./a///"), "a"); - UASSERT_SELFTEST(const string, filenameCleanup("///a/./b///."), "/a/./b/."); - UASSERT_SELFTEST(const string, filenameCleanup("aaa/bbb/ccc/"), "aaa/bbb/ccc"); - UASSERT_SELFTEST(const string, filenameCleanup("./aaa/bbb/ccc/"), "aaa/bbb/ccc"); - UASSERT_SELFTEST(const string, filenameCleanup("../aaa/bbb/ccc/"), "../aaa/bbb/ccc"); - UASSERT_SELFTEST(const string, filenameDir("a.a/b.b/f.e"), "a.a/b.b"); - UASSERT_SELFTEST(const string, filenameExt("a.a/b.b/f"), ""); - UASSERT_SELFTEST(const string, filenameExt("a.a/b.b/f.e"), ".e"); - UASSERT_SELFTEST(const string, filenameNonDirExt("a.a/b.b/f.e"), "f"); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b", "/a/b"), "."); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b", "/a/b/c"), ".."); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b", "/a/b/c/d"), "../.."); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b/x", "/a/b/c/d"), "../../x"); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b/x/y", "/"), "a/b/x/y"); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b/x/y", "/a/b"), "x/y"); - UASSERT_SELFTEST(const string, filenameRelativePath("/a/b/x/y", "/a/q"), "../b/x/y"); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b", "a/b"), "."); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b", "a/b/c"), ".."); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b", "a/b/c/d"), "../.."); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b/x", "a/b/c/d"), "../../x"); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b/x/y", ""), "a/b/x/y"); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b/x/y", "a/b"), "x/y"); - UASSERT_SELFTEST(const string, filenameRelativePath("a/b/x/y", "a/q"), "../b/x/y"); + UASSERT_SELFTEST(filenameCleanup(""), ""); + UASSERT_SELFTEST(filenameCleanup("."), "."); + UASSERT_SELFTEST(filenameCleanup(".."), ".."); + UASSERT_SELFTEST(filenameCleanup("/"), "/"); + UASSERT_SELFTEST(filenameCleanup("../"), ".."); + UASSERT_SELFTEST(filenameCleanup("//"), "/"); + UASSERT_SELFTEST(filenameCleanup("//."), "/."); + UASSERT_SELFTEST(filenameCleanup("./"), "."); + UASSERT_SELFTEST(filenameCleanup("././"), "."); + UASSERT_SELFTEST(filenameCleanup(".///"), "."); + UASSERT_SELFTEST(filenameCleanup("a"), "a"); + UASSERT_SELFTEST(filenameCleanup("a/"), "a"); + UASSERT_SELFTEST(filenameCleanup("a/b"), "a/b"); + UASSERT_SELFTEST(filenameCleanup("././//./a/b"), "a/b"); + UASSERT_SELFTEST(filenameCleanup(".//./a///"), "a"); + UASSERT_SELFTEST(filenameCleanup("///a/./b///."), "/a/./b/."); + UASSERT_SELFTEST(filenameCleanup("aaa/bbb/ccc/"), "aaa/bbb/ccc"); + UASSERT_SELFTEST(filenameCleanup("./aaa/bbb/ccc/"), "aaa/bbb/ccc"); + UASSERT_SELFTEST(filenameCleanup("../aaa/bbb/ccc/"), "../aaa/bbb/ccc"); + UASSERT_SELFTEST(filenameDir("a.a/b.b/f.e"), "a.a/b.b"); + UASSERT_SELFTEST(filenameExt("a.a/b.b/f"), ""); + UASSERT_SELFTEST(filenameExt("a.a/b.b/f.e"), ".e"); + UASSERT_SELFTEST(filenameNonDirExt("a.a/b.b/f.e"), "f"); + UASSERT_SELFTEST(filenameRelativePath("/a/b", "/a/b"), "."); + UASSERT_SELFTEST(filenameRelativePath("/a/b", "/a/b/c"), ".."); + UASSERT_SELFTEST(filenameRelativePath("/a/b", "/a/b/c/d"), "../.."); + UASSERT_SELFTEST(filenameRelativePath("/a/b/x", "/a/b/c/d"), "../../x"); + UASSERT_SELFTEST(filenameRelativePath("/a/b/x/y", "/"), "a/b/x/y"); + UASSERT_SELFTEST(filenameRelativePath("/a/b/x/y", "/a/b"), "x/y"); + UASSERT_SELFTEST(filenameRelativePath("/a/b/x/y", "/a/q"), "../b/x/y"); + UASSERT_SELFTEST(filenameRelativePath("a/b", "a/b"), "."); + UASSERT_SELFTEST(filenameRelativePath("a/b", "a/b/c"), ".."); + UASSERT_SELFTEST(filenameRelativePath("a/b", "a/b/c/d"), "../.."); + UASSERT_SELFTEST(filenameRelativePath("a/b/x", "a/b/c/d"), "../../x"); + UASSERT_SELFTEST(filenameRelativePath("a/b/x/y", ""), "a/b/x/y"); + UASSERT_SELFTEST(filenameRelativePath("a/b/x/y", "a/b"), "x/y"); + UASSERT_SELFTEST(filenameRelativePath("a/b/x/y", "a/q"), "../b/x/y"); #endif } diff --git a/src/V3PreExpr.h b/src/V3PreExpr.h index e3321f673..dc4968a0d 100644 --- a/src/V3PreExpr.h +++ b/src/V3PreExpr.h @@ -159,7 +159,7 @@ class V3PreExpr final { } } const bool got = parser.result(); - UASSERT_SELFTEST(const bool, got, expect); + UASSERT_SELFTEST(got, expect); } // METHODS diff --git a/src/V3String.cpp b/src/V3String.cpp index 5978b4376..c3db83d1d 100644 --- a/src/V3String.cpp +++ b/src/V3String.cpp @@ -396,7 +396,7 @@ uint64_t VString::hashMurmur(const string& str) VL_PURE { } void VString::selfTest() { - UASSERT_SELFTEST(const string&, VString::replaceSubstr("aa", "a", "ba"), "baba"); + UASSERT_SELFTEST(VString::replaceSubstr("aa", "a", "ba"), "baba"); } //###################################################################### @@ -786,8 +786,8 @@ string VSpellCheck::bestCandidateInfo(const string& goal, EditDistance& distance } void VSpellCheck::selfTestDistanceOne(const string& a, const string& b, EditDistance expected) { - UASSERT_SELFTEST(const EditDistance, editDistance(a, b), expected); - UASSERT_SELFTEST(const EditDistance, editDistance(b, a), expected); + UASSERT_SELFTEST(editDistance(a, b), expected); + UASSERT_SELFTEST(editDistance(b, a), expected); } void VSpellCheck::selfTestSuggestOne(bool matches, const string& c, const string& goal, @@ -797,10 +797,10 @@ void VSpellCheck::selfTestSuggestOne(bool matches, const string& c, const string speller.pushCandidate(c); const string got = speller.bestCandidateInfo(goal, gdist /*ref*/); if (matches) { - UASSERT_SELFTEST(const string&, got, c); - UASSERT_SELFTEST(const EditDistance, gdist, dist); + UASSERT_SELFTEST(got, c); + UASSERT_SELFTEST(gdist, dist); } else { - UASSERT_SELFTEST(const string&, got, ""); + UASSERT_SELFTEST(got, ""); } } @@ -821,16 +821,16 @@ void VSpellCheck::selfTest() { } { const VSpellCheck speller; - UASSERT_SELFTEST(const string, "", speller.bestCandidate("")); + UASSERT_SELFTEST(speller.bestCandidate(""), ""); } { VSpellCheck speller; speller.pushCandidate("fred"); speller.pushCandidate("wilma"); speller.pushCandidate("barney"); - UASSERT_SELFTEST(const string, "fred", speller.bestCandidate("fre")); - UASSERT_SELFTEST(const string, "wilma", speller.bestCandidate("whilma")); - UASSERT_SELFTEST(const string, "barney", speller.bestCandidate("Barney")); - UASSERT_SELFTEST(const string, "", speller.bestCandidate("nothing close")); + UASSERT_SELFTEST(speller.bestCandidate("fre"), "fred"); + UASSERT_SELFTEST(speller.bestCandidate("whilma"), "wilma"); + UASSERT_SELFTEST(speller.bestCandidate("Barney"), "barney"); + UASSERT_SELFTEST(speller.bestCandidate("nothing close"), ""); } }