Commits

Matt Oswald  committed 6fd2541

applying universal- and rvalue-references where possible (doesn't make huge dent in runtime with these simple types, but end-user types may be different)

  • Participants
  • Parent commits 90c7e5b

Comments (0)

Files changed (19)

File Tests/UnitTests/Attributes.cpp

     xUnitpp::TestCollection collection;
     std::vector<std::shared_ptr<xUnitpp::TestEventRecorder>> localEventRecorders;
     xUnitpp::TestCollection::Register reg(collection, []() { SkippedTest().RunTest(); },
-        "SkippedTest", "Attributes", attributes, -1, __FILE__, __LINE__, localEventRecorders);
-
+        "SkippedTest", "Attributes", std::forward<decltype(attributes)>(attributes), -1, __FILE__, __LINE__, std::forward<decltype(localEventRecorders)>(localEventRecorders));
+    
     xUnitpp::RunTests(record, [](const xUnitpp::TestDetails &) { return true; },
         collection.Tests(), xUnitpp::Time::Duration::zero(), 0);
 }

File Tests/UnitTests/LineInfo.cpp

     xUnitpp::TestCollection collection;
     std::vector<std::shared_ptr<xUnitpp::TestEventRecorder>> localEventRecorders;
     xUnitpp::TestCollection::Register reg(collection, test,
-        "LineInfoOverridesDefaultTestLineInfo", "LineInfo", attributes,
-        -1, __FILE__, __LINE__, localEventRecorders);
+        "LineInfoOverridesDefaultTestLineInfo", "LineInfo", std::forward<decltype(attributes)>(attributes),
+        -1, __FILE__, __LINE__, std::forward<decltype(localEventRecorders)>(localEventRecorders));
 
     xUnitpp::RunTests(record, [](const xUnitpp::TestDetails &) { return true; }, collection.Tests(), xUnitpp::Time::Duration::zero(), 0);
 

File Tests/UnitTests/TestEvents.cpp

         LocalLog().Warn << "warning message";
     };
 
-    xUnitpp::TestCollection::Register reg(collection, factWithEvents, "Name", "Suite", xUnitpp::AttributeCollection(), -1, "file", 0, localEventRecorders);
+    xUnitpp::TestCollection::Register reg(collection, factWithEvents, "Name", "Suite", xUnitpp::AttributeCollection(), -1, "file", 0, std::forward<decltype(localEventRecorders)>(localEventRecorders));
 
     Run();
 
         xUnitpp::EventLevel::Debug, xUnitpp::EventLevel::Info, xUnitpp::EventLevel::Warning
     };
 
-    // This is what I *want* to do, but there's one problem:
-    // if a type doesn't have an associated `to_string`, many Assert methods (such as Equal)
-    // will fail to compile. I should fix it with SFINAE and just print the type name when
-    // to_string doesn't exist.
-    //Assert.Equal(std::begin(expectedLevels), std::end(expectedLevels), outputRecord.events.begin(), outputRecord.events.end(),
-    //    [](xUnitpp::EventLevel lvl, const std::tuple<xUnitpp::TestDetails, xUnitpp::TestEvent> &result)
-    //    {
-    //        return lvl == std::get<1>(result).Level();
-    //    });
-
-    std::vector<xUnitpp::EventLevel> actualLevels;
-    std::transform(outputRecord.events.begin(), outputRecord.events.end(), std::back_inserter(actualLevels),
-        [](const std::tuple<xUnitpp::TestDetails, xUnitpp::TestEvent> &result)
+    Assert.Equal(std::begin(expectedLevels), std::end(expectedLevels), outputRecord.events.begin(), outputRecord.events.end(),
+        [](xUnitpp::EventLevel lvl, const std::tuple<xUnitpp::TestDetails, xUnitpp::TestEvent> &result)
         {
-            return std::get<1>(result).Level();
+            return lvl == std::get<1>(result).Level();
         });
-
-    Assert.Equal(std::begin(expectedLevels), std::end(expectedLevels), std::begin(actualLevels), std::end(actualLevels));
 }
 
 FACT_FIXTURE("TestEventSources should be usable within Theories", Fixture)

File Tests/UnitTests/TestRunner.cpp

         return *this;
     }
 
-    operator std::shared_ptr<xUnitTest>() const
+    operator std::shared_ptr<xUnitTest>()
     {
-        return std::make_shared<xUnitTest>(testFn, name, name, suite, attributes, timeLimit, file, line, testEventRecorders);
+        return std::make_shared<xUnitTest>(std::move(testFn), std::move(name), std::move(name), suite, attributes, timeLimit, std::move(file), line, testEventRecorders);
     }
 
 private:

File Tests/UnitTests/Theory.cpp

     }
 
     template<typename TTheoryData>
-    void Register(const std::string &name, const std::string &params, TTheoryData &&theoryData)
+    void Register(std::string &&name, std::string &&params, TTheoryData &&theoryData)
     {
         xUnitpp::TestCollection::Register reg(collection, &TheoryUnderTest, std::forward<TTheoryData>(theoryData),
-            name, "Theory", params, attributes, -1, __FILE__, __LINE__, localEventRecorders);
+            std::move(name), "Theory", std::move(params), attributes, -1, __FILE__, __LINE__, localEventRecorders);
     }
 
     void Run()
     }
 
     template<typename TTheoryData>
-    void RegisterAndRun(const std::string &name, const std::string &params, TTheoryData &&theoryData)
+    void RegisterAndRun(std::string &&name, std::string &&params, TTheoryData &&theoryData)
     {
-        Register(name, params, std::forward<TTheoryData>(theoryData));
+        Register(std::move(name), std::move(params), std::forward<TTheoryData>(theoryData));
 
         Run();
     }

File xUnit++/src/LineInfo.cpp

 {
 }
 
-LineInfo::LineInfo(const std::string &file, int line)
-    : file(file)
+LineInfo::LineInfo(std::string &&file, int line)
+    : file(std::move(file))
     , line(line)
 {
 }
 
-const LineInfo &LineInfo::empty()
-{
-    static LineInfo empty;
-    return empty;
-}
-
 std::string to_string(const LineInfo &lineInfo)
 {
     if (lineInfo.file.empty())

File xUnit++/src/TestCollection.cpp

     return collection;
 }
 
-TestCollection::Register::Register(TestCollection &collection, const std::function<void()> &fn, const std::string &name, const std::string &suite,
-                                   const AttributeCollection &attributes, int milliseconds, const std::string &filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorder)
+TestCollection::Register::Register(TestCollection &collection, std::function<void()> &&fn, std::string &&name, const std::string &suite,
+            AttributeCollection &&attributes, int milliseconds, std::string &&filename, int line, std::vector<std::shared_ptr<TestEventRecorder>> &&testEventRecorders)
 {
-    collection.mTests.push_back(std::make_shared<xUnitTest>(fn, name, name, suite, attributes, Time::ToDuration(Time::ToMilliseconds(milliseconds)), filename, line, testEventRecorder));
+    collection.mTests.push_back(std::make_shared<xUnitTest>(std::move(fn), std::move(name), std::move(name), suite, std::move(attributes), Time::ToDuration(Time::ToMilliseconds(milliseconds)), std::move(filename), line, std::move(testEventRecorders)));
 }
 
 const std::vector<std::shared_ptr<xUnitTest>> &TestCollection::Tests()
     return mTests;
 }
 
-std::deque<std::string> TestCollection::Register::SplitParams(const std::string &params)
+std::deque<std::string> TestCollection::Register::SplitParams(std::string &&params)
 {
     // hopefully simple rules:
     //

File xUnit++/src/TestDetails.cpp

 {
 
 TestDetails::TestDetails()
-    : LineInfo(xUnitpp::LineInfo::empty())
+    : LineInfo()
 {
 }
 
-TestDetails::TestDetails(const std::string &name, const std::string &shortName, const std::string &suite, const AttributeCollection &attributes,
-                         Time::Duration timeLimit, const std::string &filename, int line)
+TestDetails::TestDetails(std::string &&name, std::string &&shortName, const std::string &suite, const AttributeCollection &attributes,
+                         Time::Duration timeLimit, std::string &&filename, int line)
     : Id(NextId())
-    , Name(name)
-    , ShortName(shortName)
+    , Name(std::move(name))
+    , ShortName(std::move(shortName))
     , Suite(suite)
-    , Attributes(attributes)
+    , Attributes(std::move(attributes))
     , TimeLimit(timeLimit)
-    , LineInfo(filename, line)
+    , LineInfo(std::move(filename), line)
 {
 }
 
 }
 
 TestDetails::TestDetails(TestDetails &&other)
-    : LineInfo(xUnitpp::LineInfo::empty())
 {
     swap(*this, other);
 }

File xUnit++/src/TestEvent.cpp

 TestEvent::TestEvent(const std::exception &e)
     : level(EventLevel::Fatal)
     , message(e.what())
-    , lineInfo(LineInfo::empty())
 {
 }
 

File xUnit++/src/xUnitAssert.cpp

 
 const xUnitAssert &xUnitAssert::None()
 {
-    static xUnitAssert none("", LineInfo::empty());
+    static xUnitAssert none("", xUnitpp::LineInfo());
     return none;
 }
 
-xUnitAssert::xUnitAssert(std::string &&call, const xUnitpp::LineInfo &lineInfo)
-    : lineInfo(lineInfo)
+xUnitAssert::xUnitAssert(std::string &&call, xUnitpp::LineInfo &&lineInfo)
+    : lineInfo(std::move(lineInfo))
     , call(std::move(call))
 {
 }
 
-xUnitAssert &xUnitAssert::CustomMessage(const std::string &message)
+xUnitAssert &xUnitAssert::CustomMessage(std::string &&message)
 {
-    customMessage = message;
+    customMessage = std::move(message);
     return *this;
 }
 
-xUnitAssert &xUnitAssert::Expected(const std::string &str)
+xUnitAssert &xUnitAssert::Expected(std::string &&str)
 {
-    expected = str;
+    expected = std::move(str);
     return *this;
 }
 
-xUnitAssert &xUnitAssert::Actual(const std::string &str)
+xUnitAssert &xUnitAssert::Actual(std::string &&str)
 {
-    actual = str;
+    actual = std::move(str);
     return *this;
 }
 
 {
 }
 
-xUnitFailure::xUnitFailure(const xUnitAssert &assert, std::function<void(const xUnitAssert &)> onFailureComplete)
+xUnitFailure::xUnitFailure(xUnitAssert &&assert, std::function<void(const xUnitAssert &)> onFailureComplete)
     : OnFailureComplete(onFailureComplete)
-    , assert(assert)
+    , assert(std::move(assert))
     , refCount(*(new int(1)))
 {
 }
     return xUnitFailure();
 }
 
-xUnitFailure Assert::OnFailure(xUnitAssert assert) const
+xUnitFailure Assert::OnFailure(xUnitAssert &&assert) const
 {
     return xUnitFailure(std::move(assert), handleFailure);
 }
     }
 }
 
-xUnitFailure Assert::Equal(const std::string &expected, const std::string &actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(const std::string &expected, const std::string &actual, LineInfo &&lineInfo) const
 {
     if (expected != actual)
     {
-        return OnFailure(xUnitAssert(callPrefix + "Equal", lineInfo)
-            .Expected(expected)
-            .Actual(actual));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "Equal", std::move(lineInfo))
+            .Expected(std::string(expected))    // can't assume expected or actual are allowed to be moved
+            .Actual(std::string(actual))));
     }
 
     return OnSuccess();
 }
 
-xUnitFailure Assert::Equal(const char *expected, const char *actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(const char *expected, const char *actual, LineInfo &&lineInfo) const
 {
-    return Equal(std::string(expected), std::string(actual), lineInfo);
+    return Equal(std::string(expected), std::string(actual), std::move(lineInfo));
 }
 
-xUnitFailure Assert::Equal(const char *expected, const std::string &actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(const char *expected, const std::string &actual, LineInfo &&lineInfo) const
 {
-    return Equal(std::string(expected), actual, lineInfo);
+    return Equal(std::string(expected), actual, std::move(lineInfo));
 }
 
-xUnitFailure Assert::Equal(const std::string &expected, const char *actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(const std::string &expected, const char *actual, LineInfo &&lineInfo) const
 {
-    return Equal(expected, std::string(actual), lineInfo);
+    return Equal(expected, std::string(actual), std::move(lineInfo));
 }
 
-xUnitFailure Assert::Equal(float expected, float actual, int precision, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(float expected, float actual, int precision, LineInfo &&lineInfo) const
 {
-    return Equal((double)expected, (double)actual, precision, lineInfo);
+    return Equal((double)expected, (double)actual, precision, std::move(lineInfo));
 }
 
-xUnitFailure Assert::Equal(double expected, double actual, int precision, const LineInfo &lineInfo) const
+xUnitFailure Assert::Equal(double expected, double actual, int precision, LineInfo &&lineInfo) const
 {
     auto er = round(expected, precision);
     auto ar = round(actual, precision);
 
-    return Equal(er, ar, [](double er, double ar) { return er == ar; }, lineInfo);
+    return Equal(er, ar, [](double er, double ar) { return er == ar; }, std::move(lineInfo));
 }
 
-xUnitFailure Assert::NotEqual(const std::string &expected, const std::string &actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::NotEqual(const std::string &expected, const std::string &actual, LineInfo &&lineInfo) const
 {
     if (expected == actual)
     {
-        return OnFailure(xUnitAssert(callPrefix + "NotEqual", lineInfo)
-            .Expected(expected)
-            .Actual(actual));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "NotEqual", std::move(lineInfo))
+            .Expected(std::string(expected))    // can't assume expected or actual are allowed to be moved
+            .Actual(std::string(actual))));
     }
 
     return OnSuccess();
 }
 
-xUnitFailure Assert::NotEqual(const char *expected, const char *actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::NotEqual(const char *expected, const char *actual, LineInfo &&lineInfo) const
 {
-    return NotEqual(std::string(expected), std::string(actual), lineInfo);
+    return NotEqual(std::string(expected), std::string(actual), std::move(lineInfo));
 }
 
-xUnitFailure Assert::NotEqual(const char *expected, const std::string &actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::NotEqual(const char *expected, const std::string &actual, LineInfo &&lineInfo) const
 {
-    return NotEqual(std::string(expected), actual, lineInfo);
+    return NotEqual(std::string(expected), actual, std::move(lineInfo));
 }
 
-xUnitFailure Assert::NotEqual(const std::string &expected, const char *actual, const LineInfo &lineInfo) const
+xUnitFailure Assert::NotEqual(const std::string &expected, const char *actual, LineInfo &&lineInfo) const
 {
-    return NotEqual(expected, std::string(actual), lineInfo);
+    return NotEqual(expected, std::string(actual), std::move(lineInfo));
 }
 
-xUnitFailure Assert::Fail(const LineInfo &lineInfo) const
+xUnitFailure Assert::Fail(LineInfo &&lineInfo) const
 {
-    return OnFailure(xUnitAssert(callPrefix + "Fail", lineInfo));
+    return OnFailure(std::move(xUnitAssert(callPrefix + "Fail", std::move(lineInfo))));
 }
 
-xUnitFailure Assert::False(bool b, const LineInfo &lineInfo) const
+xUnitFailure Assert::False(bool b, LineInfo &&lineInfo) const
 {
     if (b)
     {
-        return OnFailure(xUnitAssert(callPrefix + "False", lineInfo).Expected("false").Actual("true"));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "False", std::move(lineInfo)).Expected("false").Actual("true")));
     }
 
     return OnSuccess();
 }
 
-xUnitFailure Assert::True(bool b, const LineInfo &lineInfo) const
+xUnitFailure Assert::True(bool b, LineInfo &&lineInfo) const
 {
     if (!b)
     {
-        return OnFailure(xUnitAssert(callPrefix + "True", lineInfo).Expected("true").Actual("false"));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "True", std::move(lineInfo)).Expected("true").Actual("false")));
     }
 
     return OnSuccess();
 }
 
-xUnitFailure Assert::DoesNotContain(const char *actualString, const char *value, const LineInfo &lineInfo) const
+xUnitFailure Assert::DoesNotContain(const char *actualString, const char *value, LineInfo &&lineInfo) const
 {
-    return DoesNotContain(std::string(actualString), std::string(value), lineInfo);
+    const auto a = std::string(actualString);
+    const auto v = std::string(value);
+    return DoesNotContain(a, v, std::move(lineInfo));
 }
 
-xUnitFailure Assert::DoesNotContain(const char *actualString, const std::string &value, const LineInfo &lineInfo) const
+xUnitFailure Assert::DoesNotContain(const char *actualString, const std::string &value, LineInfo &&lineInfo) const
 {
-    return DoesNotContain(std::string(actualString), value, lineInfo);
+    const auto a = std::string(actualString);
+    return DoesNotContain(a, value, std::move(lineInfo));
 }
 
-xUnitFailure Assert::DoesNotContain(const std::string &actualString, const char *value, const LineInfo &lineInfo) const
+xUnitFailure Assert::DoesNotContain(const std::string &actualString, const char *value, LineInfo &&lineInfo) const
 {
-    return DoesNotContain(actualString, std::string(value), lineInfo);
+    const auto v = std::string(value);
+    return DoesNotContain(actualString, v, std::move(lineInfo));
 }
 
-xUnitFailure Assert::DoesNotContain(const std::string &actualString, const std::string &value, const LineInfo &lineInfo) const
+xUnitFailure Assert::DoesNotContain(const std::string &actualString, const std::string &value, LineInfo &&lineInfo) const
 {
     auto found = actualString.find(value);
     if (found != std::string::npos)
     {
-        return OnFailure(xUnitAssert(callPrefix + "DoesNotContain", lineInfo).CustomMessage("Found: \"" + value + "\" at position " + ToString(found) + "."));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "DoesNotContain", std::move(lineInfo))
+            .CustomMessage("Found: \"" + value + "\" at position " + ToString(found) + ".")));
     }
 
     return OnSuccess();
 }
 
-xUnitFailure Assert::Contains(const char *actualString, const char *value, const LineInfo &lineInfo) const
+xUnitFailure Assert::Contains(const char *actualString, const char *value, LineInfo &&lineInfo) const
 {
-    return Contains(std::string(actualString), std::string(value), lineInfo);
+    const auto a = std::string(actualString);
+    const auto v = std::string(value);
+    return Contains(a, v, std::move(lineInfo));
 }
 
-xUnitFailure Assert::Contains(const char *actualString, const std::string &value, const LineInfo &lineInfo) const
+xUnitFailure Assert::Contains(const char *actualString, const std::string &value, LineInfo &&lineInfo) const
 {
-    return Contains(std::string(actualString), std::string(value), lineInfo);
+    const auto a = std::string(actualString);
+    return Contains(a, value, std::move(lineInfo));
 }
 
-xUnitFailure Assert::Contains(const std::string &actualString, const char *value, const LineInfo &lineInfo) const
+xUnitFailure Assert::Contains(const std::string &actualString, const char *value, LineInfo &&lineInfo) const
 {
-    return Contains(actualString, std::string(value), lineInfo);
+    const auto v = std::string(value);
+    return Contains(actualString, v, std::move(lineInfo));
 }
 
-xUnitFailure Assert::Contains(const std::string &actualString, const std::string &value, const LineInfo &lineInfo) const
+xUnitFailure Assert::Contains(const std::string &actualString, const std::string &value, LineInfo &&lineInfo) const
 {
     if (actualString.find(value) == std::string::npos)
     {
-        return OnFailure(xUnitAssert(callPrefix + "Contains", lineInfo).Expected(actualString).Actual(value));
+        return OnFailure(std::move(xUnitAssert(callPrefix + "Contains", std::move(lineInfo))
+            .Expected(std::string(actualString))    // can't assume actualString or value can be moved
+            .Actual(std::string(value))));
     }
 
     return OnSuccess();
 }
 
-Assert::Assert(const std::string &callPrefix, std::function<void (const xUnitAssert &)> onFailure)
-    : callPrefix(callPrefix)
-    , handleFailure(onFailure)
+Assert::Assert(std::string &&callPrefix, std::function<void (const xUnitAssert &)> &&onFailure)
+    : callPrefix(std::move(callPrefix))
+    , handleFailure(std::move(onFailure))
 {
 }
 

File xUnit++/src/xUnitTest.cpp

 namespace xUnitpp
 {
 
-xUnitTest::xUnitTest(std::function<void()> test, const std::string &name, const std::string &shortName, const std::string &suite,
+xUnitTest::xUnitTest(std::function<void()> &&test, std::string &&name, std::string &&shortName, const std::string &suite,
                      const AttributeCollection &attributes, Time::Duration timeLimit,
-                     const std::string &filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders)
-    : test(test)
-    , testDetails(name, shortName, suite, attributes, timeLimit, filename, line)
+                     std::string &&filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders)
+    : test(std::move(test))
+    , testDetails(std::move(name), std::move(shortName), suite, attributes, timeLimit, std::move(filename), line)
     , testEventRecorders(testEventRecorders)
     , failureEventLogged(false)
 {

File xUnit++/xUnit++/LineInfo.h

 
 struct LineInfo
 {
-    LineInfo(const std::string &file, int line);
-
-    static const LineInfo &empty();
+    LineInfo();
+    LineInfo(std::string &&file, int line);
 
     std::string file;
     int line;
 
     friend std::string to_string(const LineInfo &lineInfo);
-
-private:
-    LineInfo();
 };
 
 }

File xUnit++/xUnit++/TestCollection.h

         template<typename TFn, typename TArg0>
         static std::function<void()> TheoryHelper(TFn &&theory, std::tuple<TArg0> &&t)
         {
-            return [=]() { return theory(std::get<0>(t)); };
+            return [=]() { theory(std::get<0>(t)); };
         }
 
         template<typename TFn, typename TArg0, typename TArg1>
         static std::function<void()> TheoryHelper(TFn &&theory, std::tuple<TArg0, TArg1> &&t)
         {
-            return [=]() { return theory(std::get<0>(t),
-                                         std::get<1>(t)); };
+            return [=]() { theory(std::get<0>(t),
+                                  std::get<1>(t)); };
         }
 
         template<typename TFn, typename TArg0, typename TArg1, typename TArg2>
         static std::function<void()> TheoryHelper(TFn &&theory, std::tuple<TArg0, TArg1, TArg2> &&t)
         {
-            return [=]() { return theory(std::get<0>(t),
-                                         std::get<1>(t),
-                                         std::get<2>(t)); };
+            return [=]() { theory(std::get<0>(t),
+                                  std::get<1>(t),
+                                  std::get<2>(t)); };
         }
 
         template<typename TFn, typename TArg0, typename TArg1, typename TArg2, typename TArg3>
         static std::function<void()> TheoryHelper(TFn &&theory, std::tuple<TArg0, TArg1, TArg2, TArg3> &&t)
         {
-            return [=]() { return theory(std::get<0>(t),
-                                         std::get<1>(t),
-                                         std::get<2>(t),
-                                         std::get<3>(t)); };
+            return [=]() { theory(std::get<0>(t),
+                                  std::get<1>(t),
+                                  std::get<2>(t),
+                                  std::get<3>(t)); };
         }
 
         template<typename TFn, typename TArg0, typename TArg1, typename TArg2, typename TArg3, typename TArg4>
         static std::function<void()> TheoryHelper(TFn &&theory, std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4> &&t)
         {
-            return [=]() { return theory(std::get<0>(t),
-                                         std::get<1>(t),
-                                         std::get<2>(t),
-                                         std::get<3>(t),
-                                         std::get<4>(t)); };
+            return [=]() { theory(std::get<0>(t),
+                                  std::get<1>(t),
+                                  std::get<2>(t),
+                                  std::get<3>(t),
+                                  std::get<4>(t)); };
         }
 
-        static std::deque<std::string> SplitParams(const std::string &params);
+        static std::deque<std::string> SplitParams(std::string &&params);
 
         // !!!VS something else that can be simplified once VS understands variadic macros...
         template<typename TArg0>
-        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, const std::tuple<TArg0> &t) const
+        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, std::tuple<TArg0> &&t) const
         {
-            name += params[0] + ": " + ToString(std::get<0>(t)) + ")";
+            name += params[0] + ": " + ToString(std::get<0>(std::forward<std::tuple<TArg0>>(t))) + ")";
 
             return name;
         }
 
         template<typename TArg0, typename TArg1>
-        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, const std::tuple<TArg0, TArg1> &t) const
+        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, std::tuple<TArg0, TArg1> &&t) const
         {
-            name += params[0] + ": " + ToString(std::get<0>(t)) + ", ";
-            name += params[1] + ": " + ToString(std::get<1>(t)) + ")";
+            name += params[0] + ": " + ToString(std::get<0>(std::forward<std::tuple<TArg0, TArg1>>(t))) + ", ";
+            name += params[1] + ": " + ToString(std::get<1>(std::forward<std::tuple<TArg0, TArg1>>(t))) + ")";
 
             return name;
         }
 
         template<typename TArg0, typename TArg1, typename TArg2>
-        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, const std::tuple<TArg0, TArg1, TArg2> &t) const
+        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, std::tuple<TArg0, TArg1, TArg2> &&t) const
         {
-            name += params[0] + ": " + ToString(std::get<0>(t)) + ", ";
-            name += params[1] + ": " + ToString(std::get<1>(t)) + ", ";
-            name += params[2] + ": " + ToString(std::get<2>(t)) + ")";
+            name += params[0] + ": " + ToString(std::get<0>(std::forward<std::tuple<TArg0, TArg1, TArg2>>(t))) + ", ";
+            name += params[1] + ": " + ToString(std::get<1>(std::forward<std::tuple<TArg0, TArg1, TArg2>>(t))) + ", ";
+            name += params[2] + ": " + ToString(std::get<2>(std::forward<std::tuple<TArg0, TArg1, TArg2>>(t))) + ")";
 
             return name;
         }
 
         template<typename TArg0, typename TArg1, typename TArg2, typename TArg3>
-        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, const std::tuple<TArg0, TArg1, TArg2, TArg3> &t) const
+        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, std::tuple<TArg0, TArg1, TArg2, TArg3> &&t) const
         {
-            name += params[0] + ": " + ToString(std::get<0>(t)) + ", ";
-            name += params[1] + ": " + ToString(std::get<1>(t)) + ", ";
-            name += params[2] + ": " + ToString(std::get<2>(t)) + ", ";
-            name += params[3] + ": " + ToString(std::get<3>(t)) + ")";
+            name += params[0] + ": " + ToString(std::get<0>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3>>(t))) + ", ";
+            name += params[1] + ": " + ToString(std::get<1>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3>>(t))) + ", ";
+            name += params[2] + ": " + ToString(std::get<2>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3>>(t))) + ", ";
+            name += params[3] + ": " + ToString(std::get<3>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3>>(t))) + ")";
 
             return name;
         }
 
         template<typename TArg0, typename TArg1, typename TArg2, typename TArg3, typename TArg4>
-        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, const std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4> &t) const
+        std::string GetLongTheoryName(std::string name, const std::deque<std::string> &params, std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4> &&t) const
         {
-            name += params[0] + ": " + ToString(std::get<0>(t)) + ", ";
-            name += params[1] + ": " + ToString(std::get<1>(t)) + ", ";
-            name += params[2] + ": " + ToString(std::get<2>(t)) + ", ";
-            name += params[3] + ": " + ToString(std::get<3>(t)) + ", ";
-            name += params[4] + ": " + ToString(std::get<4>(t)) + ")";
+            name += params[0] + ": " + ToString(std::get<0>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4>>(t))) + ", ";
+            name += params[1] + ": " + ToString(std::get<1>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4>>(t))) + ", ";
+            name += params[2] + ": " + ToString(std::get<2>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4>>(t))) + ", ";
+            name += params[3] + ": " + ToString(std::get<3>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4>>(t))) + ", ";
+            name += params[4] + ": " + ToString(std::get<4>(std::forward<std::tuple<TArg0, TArg1, TArg2, TArg3, TArg4>>(t))) + ")";
 
             return name;
         }
 
     public:
-        Register(TestCollection &collection, const std::function<void()> &fn, const std::string &name, const std::string &suite,
-            const AttributeCollection &attributes, int milliseconds, const std::string &filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders);
+        Register(TestCollection &collection, std::function<void()> &&fn, std::string &&name, const std::string &suite,
+            AttributeCollection &&attributes, int milliseconds, std::string &&filename, int line, std::vector<std::shared_ptr<TestEventRecorder>> &&testEventRecorders);
 
         template<typename TTheory, typename TTheoryData>
-        Register(TestCollection &collection, TTheory theory, TTheoryData theoryData, const std::string &name, const std::string &suite, const std::string &params,
-            const AttributeCollection &attributes, int milliseconds, const std::string &filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders)
+        Register(TestCollection &collection, TTheory &&theory_, TTheoryData &&theoryData_, std::string &&name, const std::string &suite, std::string &&params,
+            const AttributeCollection &attributes, int milliseconds, std::string &&filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders)
         {
+            auto theory = theory_;
+            auto theoryData = theoryData_;
+
             int id = 0;
             for (auto t : theoryData())
             {
-                auto theoryName = GetLongTheoryName(name + " [" + ToString(id++) + "] (", SplitParams(params), t);
+                auto theoryName = GetLongTheoryName(name + " [" + ToString(id++) + "] (", SplitParams(std::move(params)), std::forward<decltype(t)>(t));
 
-                collection.mTests.push_back(std::make_shared<xUnitTest>(TheoryHelper(theory, std::move(t)), theoryName, name, suite,
-                    attributes, Time::ToDuration(Time::ToMilliseconds(milliseconds)), filename, line, testEventRecorders));
+                collection.mTests.push_back(std::make_shared<xUnitTest>(TheoryHelper(std::forward<TTheory>(theory), std::move(t)), std::move(theoryName), std::move(name), suite,
+                    attributes, Time::ToDuration(Time::ToMilliseconds(milliseconds)), std::move(filename), line, testEventRecorders));
             }
         }
     };

File xUnit++/xUnit++/TestDetails.h

 struct TestDetails
 {
     TestDetails();
-    TestDetails(const std::string &name, const std::string &shortName, const std::string &suite,
+    TestDetails(std::string &&name, std::string &&shortName, const std::string &suite,
         const AttributeCollection &attributes, Time::Duration timeLimit,
-        const std::string &filename, int line);
+        std::string &&filename, int line);
     TestDetails(const TestDetails &other);
     TestDetails(TestDetails &&other);
     TestDetails &operator =(TestDetails other);

File xUnit++/xUnit++/TestEvent.h

 class TestEvent
 {
 public:
-    TestEvent(EventLevel level, const std::string &message, const LineInfo &lineInfo = LineInfo::empty());
+    TestEvent(EventLevel level, const std::string &message, const LineInfo &lineInfo = xUnitpp::LineInfo());
     TestEvent(EventLevel level, const xUnitAssert &assert);
     TestEvent(const std::exception &e);
 

File xUnit++/xUnit++/xUnitAssert.h

     typedef std::exception base;
 
 public:
-    xUnitAssert(std::string &&call, const LineInfo &lineInfo);
+    xUnitAssert(std::string &&call, LineInfo &&lineInfo);
 
-    xUnitAssert &CustomMessage(const std::string &message);
-    xUnitAssert &Expected(const std::string &expected);
-    xUnitAssert &Actual(const std::string &actual);
+    xUnitAssert &CustomMessage(std::string &&message);
+    xUnitAssert &Expected(std::string &&expected);
+    xUnitAssert &Actual(std::string &&actual);
 
     template<typename T>
-    xUnitAssert &AppendUserMessage(const T &value)
+    xUnitAssert &AppendUserMessage(T &&value)
     {
         std::stringstream str;
-        str << value;
+        str << std::forward<T>(value);
         userMessage.push_back(str.str());
 
         return *this;
     xUnitFailure();
 
 public:
-    xUnitFailure(const xUnitAssert &assert, std::function<void(const xUnitAssert &)> onFailureComplete);
+    xUnitFailure(xUnitAssert &&assert, std::function<void(const xUnitAssert &)> onFailureComplete);
     xUnitFailure(const xUnitFailure &other);
     ~xUnitFailure() noexcept(false);
 
     static xUnitFailure None();
 
     template<typename T>
-    xUnitFailure &operator <<(const T &value)
+    xUnitFailure &operator <<(T &&value)
     {
-        assert.AppendUserMessage(value);
+        assert.AppendUserMessage(std::forward<T>(value));
         return *this;
     }
 
         static const bool value = (sizeof(f<T>(nullptr)) == sizeof(char));
     };
 
-    xUnitFailure OnFailure(xUnitAssert assert) const;
+    xUnitFailure OnFailure(xUnitAssert &&assert) const;
     xUnitFailure OnSuccess() const;
 
     std::string callPrefix;
 
 public:
     template<typename TExpected, typename TActual, typename TComparer>
-    xUnitFailure Equal(TExpected expected, TActual actual, TComparer comparer, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Equal(TExpected expected, TActual actual, TComparer &&comparer, LineInfo &&lineInfo = LineInfo()) const
     {
-        if (!comparer(expected, actual))
+        if (!comparer(std::forward<TExpected>(expected), std::forward<TActual>(actual)))
         {
-            return OnFailure(xUnitAssert(callPrefix + "Equal", lineInfo).Expected(ToString(expected)).Actual(ToString(actual)));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Equal", std::move(lineInfo))
+                .Expected(ToString(std::forward<TExpected>(expected)))
+                .Actual(ToString(std::forward<TActual>(actual)))));
         }
 
         return OnSuccess();
     }
 
     template<typename TExpected, typename TActual>
-    xUnitFailure Equal(TExpected expected, TActual actual, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Equal(TExpected expected, TActual actual, LineInfo &&lineInfo = LineInfo()) const
     {
-        return Equal(expected, actual, [](TExpected expected, TActual actual) { return expected == actual; }, lineInfo);
+        return Equal(std::forward<TExpected>(expected), std::forward<TActual>(actual), [](TExpected &&expected, TActual &&actual) { return expected == actual; }, std::move(lineInfo));
     }
 
-    xUnitFailure Equal(const char *expected, const char *actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Equal(const char *expected, const std::string &actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Equal(const std::string &expected, const char *actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Equal(const std::string &expected, const std::string &actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Equal(float expected, float actual, int precision, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Equal(double expected, double actual, int precision, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure Equal(const char *expected, const char *actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Equal(const char *expected, const std::string &actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Equal(const std::string &expected, const char *actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Equal(const std::string &expected, const std::string &actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Equal(float expected, float actual, int precision, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Equal(double expected, double actual, int precision, LineInfo &&lineInfo = LineInfo()) const;
 
     template<typename TExpected, typename TActual, typename TComparer>
-    xUnitFailure Equal(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, TComparer &&comparer, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Equal(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, TComparer &&comparer, LineInfo &&lineInfo = LineInfo()) const
     {
         auto expected = expectedBegin;
         auto actual = actualBegin;
 
         if (expected != expectedEnd || actual != actualEnd)
         {
-            return OnFailure(xUnitAssert(callPrefix + "Equal", lineInfo)
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Equal", std::move(lineInfo))
                 .CustomMessage("Sequence unequal at location " + ToString(index) + ".")
                 .Expected(RangeToString(std::forward<TExpected>(expectedBegin), std::forward<TExpected>(expectedEnd)))
-                .Actual(RangeToString(std::forward<TActual>(actualBegin), std::forward<TActual>(actualEnd))));
+                .Actual(RangeToString(std::forward<TActual>(actualBegin), std::forward<TActual>(actualEnd)))));
         }
 
         return OnSuccess();
     }
 
     template<typename TExpected, typename TActual>
-    xUnitFailure Equal(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Equal(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, LineInfo &&lineInfo = LineInfo()) const
     {
-        return Equal(std::forward<TExpected>(expectedBegin), std::forward<TExpected>(expectedEnd), std::forward<TActual>(actualBegin), std::forward<TActual>(actualEnd), [](decltype(*expectedBegin) a, decltype(*actualBegin) b) { return a == b; }, lineInfo);
+        return Equal(std::forward<TExpected>(expectedBegin), std::forward<TExpected>(expectedEnd),
+            std::forward<TActual>(actualBegin), std::forward<TActual>(actualEnd),
+            [](decltype(*expectedBegin) &&a, decltype(*actualBegin) &&b) { return a == b; }, std::move(lineInfo));
     }
 
     template<typename TExpected, typename TActual, typename TComparer>
-    xUnitFailure NotEqual(TExpected expected, TActual actual, TComparer comparer, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotEqual(TExpected expected, TActual actual, TComparer &&comparer, LineInfo &&lineInfo = LineInfo()) const
     {
-        if (comparer(expected, actual))
+        if (comparer(std::forward<TExpected>(expected), std::forward<TActual>(actual)))
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotEqual", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotEqual", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TExpected, typename TActual>
-    xUnitFailure NotEqual(TExpected expected, TActual actual, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotEqual(TExpected expected, TActual actual, LineInfo &&lineInfo = LineInfo()) const
     {
-        return NotEqual(expected, actual, [](TExpected expected, TActual actual) { return expected == actual; }, lineInfo);
+        return NotEqual(std::forward<TExpected>(expected), std::forward<TActual>(actual), [](TExpected &&expected, TActual &&actual) { return expected == actual; }, std::move(lineInfo));
     }
 
-    xUnitFailure NotEqual(const char *expected, const char *actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure NotEqual(const char *expected, const std::string &actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure NotEqual(const std::string &expected, const char *actual, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure NotEqual(const std::string &expected, const std::string &actual, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure NotEqual(const char *expected, const char *actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure NotEqual(const char *expected, const std::string &actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure NotEqual(const std::string &expected, const char *actual, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure NotEqual(const std::string &expected, const std::string &actual, LineInfo &&lineInfo = LineInfo()) const;
 
     template<typename TExpected, typename TActual, typename TComparer>
-    xUnitFailure NotEqual(const TExpected &expectedBegin, const TExpected &expectedEnd, const TActual &actualBegin, const TActual &actualEnd, TComparer comparer, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotEqual(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, TComparer &&comparer, LineInfo &&lineInfo = LineInfo()) const
     {
         auto expected = expectedBegin;
         auto actual = actualBegin;
 
         if (expected == expectedEnd && actual == actualEnd)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotEqual", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotEqual", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TExpected, typename TActual>
-    xUnitFailure NotEqual(const TExpected &expectedBegin, const TExpected &expectedEnd, const TActual &actualBegin, const TActual &actualEnd, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotEqual(TExpected &&expectedBegin, TExpected &&expectedEnd, TActual &&actualBegin, TActual &&actualEnd, LineInfo &&lineInfo = LineInfo()) const
     {
-        return NotEqual(expectedBegin, expectedEnd, actualBegin, actualEnd, [](decltype(*expectedBegin) a, decltype(*actualBegin) b) { return a == b; }, lineInfo);
+        return NotEqual(std::forward<TExpected>(expectedBegin), std::forward<TExpected>(expectedEnd),
+            std::forward<TActual>(actualBegin), std::forward<TActual>(actualEnd),
+            [](decltype(*expectedBegin) &&a, decltype(*actualBegin) &&b) { return a == b; }, std::move(lineInfo));
     }
 
 
     template<typename TFunc>
-    xUnitFailure DoesNotThrow(TFunc &&fn, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure DoesNotThrow(TFunc &&fn, LineInfo &&lineInfo = LineInfo()) const
     {
         try
         {
         }
         catch (const std::exception &e)
         {
-            return OnFailure(xUnitAssert(callPrefix + "DoesNotThrow", lineInfo)
+            return OnFailure(std::move(xUnitAssert(callPrefix + "DoesNotThrow", std::move(lineInfo))
                 .Expected("(no exception)")
-                .Actual(e.what()));
+                .Actual(e.what())));
         }
         catch (...)
         {
-            return OnFailure(xUnitAssert(callPrefix + "DoesNotThrow", lineInfo)
+            return OnFailure(std::move(xUnitAssert(callPrefix + "DoesNotThrow", std::move(lineInfo))
                 .Expected("(no exception)")
-                .Actual("Crash: unknown exception."));
+                .Actual("Crash: unknown exception.")));
         }
 
         return OnSuccess();
     }
 
-    xUnitFailure Fail(const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure Fail(LineInfo &&lineInfo = LineInfo()) const;
 
-    xUnitFailure False(bool b, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure False(bool b, LineInfo &&lineInfo = LineInfo()) const;
 
-    xUnitFailure True(bool b, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure True(bool b, LineInfo &&lineInfo = LineInfo()) const;
 
     template<typename TSequence>
-    typename std::enable_if<has_empty<TSequence>::value, xUnitFailure>::type Empty(const TSequence &sequence, const LineInfo &lineInfo = LineInfo::empty()) const
+    typename std::enable_if<has_empty<typename std::remove_reference<TSequence>::type>::value, xUnitFailure>::type Empty(TSequence &&sequence, LineInfo &&lineInfo = LineInfo()) const
     {
         if (!sequence.empty())
         {
-            return OnFailure(xUnitAssert(callPrefix + "Empty", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Empty", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence>
-    typename std::enable_if<!has_empty<TSequence>::value, xUnitFailure>::type Empty(const TSequence &sequence, const LineInfo &lineInfo = LineInfo::empty()) const
+    typename std::enable_if<!has_empty<typename std::remove_reference<TSequence>::type>::value, xUnitFailure>::type Empty(TSequence &&sequence, LineInfo &&lineInfo = LineInfo()) const
     {
-        using namespace std;
+        using std::begin;
+        using std::end;
 
-        if (begin(sequence) != end(sequence))
+        if (begin(std::forward<TSequence>(sequence)) != end(std::forward<TSequence>(sequence)))
         {
-            return OnFailure(xUnitAssert(callPrefix + "Empty", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Empty", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence>
-    typename std::enable_if<has_empty<TSequence>::value, xUnitFailure>::type NotEmpty(const TSequence &sequence, const LineInfo &lineInfo = LineInfo::empty()) const
+    typename std::enable_if<has_empty<TSequence>::value, xUnitFailure>::type NotEmpty(TSequence &&sequence, LineInfo &&lineInfo = LineInfo()) const
     {
         if (sequence.empty())
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotEmpty", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotEmpty", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence>
-    typename std::enable_if<!has_empty<TSequence>::value, xUnitFailure>::type NotEmpty(const TSequence &sequence, const LineInfo &lineInfo = LineInfo::empty()) const
+    typename std::enable_if<!has_empty<TSequence>::value, xUnitFailure>::type NotEmpty(TSequence &&sequence, LineInfo &&lineInfo = LineInfo()) const
     {
-        using namespace std;
+        using std::begin;
+        using std::end;
 
-        if (begin(sequence) == end(sequence))
+        if (begin(std::forward<TSequence>(sequence)) == end(std::forward<TSequence>(sequence)))
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotEmpty", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotEmpty", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence, typename TPredicate>
-    xUnitFailure DoesNotContainPred(const TSequence &sequence, TPredicate &&predicate, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure DoesNotContainPred(const TSequence &sequence, TPredicate &&predicate, LineInfo &&lineInfo = LineInfo()) const
     {
-        auto found = std::find_if(std::begin(sequence), std::end(sequence), std::forward<TPredicate>(predicate));
-        if (found != std::end(sequence))
+        using std::begin;
+        using std::end;
+
+        auto found = std::find_if(begin(sequence), end(sequence), std::forward<TPredicate>(predicate));
+        if (found != end(std::forward<TSequence>(sequence)))
         {
-            return OnFailure(xUnitAssert(callPrefix + "DoesNotContain", lineInfo)
-                .CustomMessage("Found: matching value at position " + ToString(std::distance(std::begin(sequence), found)) + "."));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "DoesNotContain", std::move(lineInfo))
+                .CustomMessage("Found: matching value at position " + ToString(std::distance(begin(sequence), found)) + ".")));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence, typename T>
-    xUnitFailure DoesNotContain(const TSequence &sequence, T value, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure DoesNotContain(const TSequence &sequence, T &&value, LineInfo &&lineInfo = LineInfo()) const
     {
-        return DoesNotContainPred(sequence, [&value](const T& actual) { return actual == value; }, lineInfo);
+        using std::begin;
+        using std::end;
+
+        if (std::find(begin(sequence), end(sequence), std::forward<T>(value)) != end(sequence))
+        {
+            return OnFailure(std::move(xUnitAssert(callPrefix + "DoesNotContain", std::move(lineInfo))));
+        }
+
+        return OnSuccess();
     }
 
-    xUnitFailure DoesNotContain(const char *actualString, const char *value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure DoesNotContain(const char *actualString, const std::string &value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure DoesNotContain(const std::string &actualString, const char *value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure DoesNotContain(const std::string &actualString, const std::string &value, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure DoesNotContain(const char *actualString, const char *value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure DoesNotContain(const char *actualString, const std::string &value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure DoesNotContain(const std::string &actualString, const char *value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure DoesNotContain(const std::string &actualString, const std::string &value, LineInfo &&lineInfo = LineInfo()) const;
 
     template<typename TSequence, typename TPredicate>
-    xUnitFailure ContainsPred(const TSequence &sequence, TPredicate &&predicate, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure ContainsPred(const TSequence &sequence, TPredicate &&predicate, LineInfo &&lineInfo = LineInfo()) const
     {
-        using namespace std;
+        using std::begin;
+        using std::end;
 
-        if (find_if(begin(sequence), end(sequence), std::forward<TPredicate>(predicate)) == end(sequence))
+        if (std::find_if(begin(sequence), end(sequence), std::forward<TPredicate>(predicate)) == end(sequence))
         {
-            return OnFailure(xUnitAssert(callPrefix + "Contains", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Contains", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename TSequence, typename T>
-    xUnitFailure Contains(const TSequence &sequence, T value, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Contains(const TSequence &sequence, T &&value, LineInfo &&lineInfo = LineInfo()) const
     {
-        return ContainsPred(sequence, [&value](const T &actual) { return actual == value; }, lineInfo);
+        using std::begin;
+        using std::end;
+
+        if (std::find(begin(sequence), end(sequence), std::forward<T>(value)) == end(sequence))
+        {
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Contains", std::move(lineInfo))));
+        }
+
+        return OnSuccess();
     }
 
-    xUnitFailure Contains(const char *actualString, const char *value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Contains(const char *actualString, const std::string &value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Contains(const std::string &actualString, const char *value, const LineInfo &lineInfo = LineInfo::empty()) const;
-    xUnitFailure Contains(const std::string &actualString, const std::string &value, const LineInfo &lineInfo = LineInfo::empty()) const;
+    xUnitFailure Contains(const char *actualString, const char *value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Contains(const char *actualString, const std::string &value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Contains(const std::string &actualString, const char *value, LineInfo &&lineInfo = LineInfo()) const;
+    xUnitFailure Contains(const std::string &actualString, const std::string &value, LineInfo &&lineInfo = LineInfo()) const;
 
     template<typename TActual, typename TRange>
-    xUnitFailure InRange(TActual actual, TRange min, TRange max, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure InRange(TActual &&actual, TRange &&min, TRange &&max, LineInfo &&lineInfo = LineInfo()) const
     {
         if (min >= max)
         {
-            throw std::invalid_argument("Assert.InRange argument error: min (" + ToString(min) + ") must be strictly less than max (" + ToString(max) + ").");
+            throw std::invalid_argument("Assert.InRange argument error: min (" + ToString(std::forward<TRange>(min)) + ") must be strictly less than max (" + ToString(std::forward<TRange>(max)) + ").");
         }
 
         if (actual < min || actual >= max)
         {
-            return OnFailure(xUnitAssert(callPrefix + "InRange", lineInfo)
-                .Expected("[" + ToString(min) + " - " + ToString(max) + ")")
-                .Actual(ToString(actual)));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "InRange", std::move(lineInfo))
+                .Expected("[" + ToString(std::forward<TRange>(min)) + " - " + ToString(std::forward<TRange>(max)) + ")")
+                .Actual(ToString(std::forward<TActual>(actual)))));
         }
 
         return OnSuccess();
     }
 
     template<typename TActual, typename TRange>
-    xUnitFailure NotInRange(TActual actual, TRange min, TRange max, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotInRange(TActual &&actual, TRange &&min, TRange &&max, LineInfo &&lineInfo = LineInfo()) const
     {
         if (min >= max)
         {
-            throw std::invalid_argument("Assert.NotInRange argument error: min (" + ToString(min) + ") must be strictly less than max (" + ToString(max) + ").");
+            throw std::invalid_argument("Assert.NotInRange argument error: min (" + ToString(std::forward<TRange>(min)) + ") must be strictly less than max (" + ToString(std::forward<TRange>(max)) + ").");
         }
 
         if (actual >= min && actual < max)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotInRange", lineInfo)
-                .Expected("[" + ToString(min) + " - " + ToString(max) + ")")
-                .Actual(ToString(actual)));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotInRange", std::move(lineInfo))
+                .Expected("[" + ToString(std::forward<TRange>(min)) + " - " + ToString(std::forward<TRange>(max)) + ")")
+                .Actual(ToString(std::forward<TActual>(actual)))));
         }
 
         return OnSuccess();
     }
 
     template<typename T>
-    xUnitFailure NotNull(const T &value, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotNull(T &&value, LineInfo &&lineInfo = LineInfo()) const
     {
         if (value == nullptr)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotNull", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotNull", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename T>
-    xUnitFailure Null(const T &value, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Null(T &&value, LineInfo &&lineInfo = LineInfo()) const
     {
         if (value != nullptr)
         {
-            return OnFailure(xUnitAssert(callPrefix + "Null", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Null", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename T>
-    xUnitFailure NotSame(const T &expected, const T &actual, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotSame(const T &expected, const T &actual, LineInfo &&lineInfo = LineInfo()) const
     {
         if (&expected == &actual)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotSame", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotSame", std::move(lineInfo))));
         }
 
         return OnSuccess();
 
 
     template<typename T>
-    xUnitFailure NotSame(const T *expected, const T *actual, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure NotSame(const T *expected, const T *actual, LineInfo &&lineInfo = LineInfo()) const
     {
         if (expected == actual)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotSame", lineInfo));
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotSame", std::move(lineInfo))));
+        }
+    
+        return OnSuccess();
+    }
+    
+    template<typename T>
+    xUnitFailure NotSame(T *expected, T *actual, LineInfo &&lineInfo = LineInfo()) const
+    {
+        if (expected == actual)
+        {
+            return OnFailure(std::move(xUnitAssert(callPrefix + "NotSame", std::move(lineInfo))));
+        }
+    
+        return OnSuccess();
+    }
+
+    template<typename T>
+    xUnitFailure Same(const T &expected, const T &actual, LineInfo &&lineInfo = LineInfo()) const
+    {
+        if (&expected != &actual)
+        {
+            return OnFailure(std::move(xUnitAssert(callPrefix + "Same", std::move(lineInfo))));
         }
 
         return OnSuccess();
     }
 
     template<typename T>
-    xUnitFailure NotSame(T *expected, T *actual, const LineInfo &lineInfo = LineInfo::empty()) const
+    xUnitFailure Same(T *expected, T *actual, LineInfo &&lineInfo = LineInfo()) const
     {
-        if (expected == actual)
+        if (expected != actual)
         {
-            return OnFailure(xUnitAssert(callPrefix + "NotSame", lineInfo));
+            return OnFailure(std::move(xUnitAssert("Same", std::move(lineInfo))));
         }
-
+    
+        return OnSuccess();
+    }
+    
+    template<typename T>
+    xUnitFailure Same(const T *expected, const T *actual, LineInfo &&lineInfo = LineInfo()) const
+    {
+        if (expected != actual)
+        {
+            return OnFailure(std::move(xUnitAssert("Same", std::move(lineInfo))));
+        }
+    
         return OnSuccess();
     }
 
-    template<typename T>
-    xUnitFailure Same(const T &expected, const T &actual, const LineInfo &lineInfo = LineInfo::empty()) const
-    {
-        if (&expected != &actual)
-        {
-            return OnFailure(xUnitAssert(callPrefix + "Same", lineInfo));
-        }
-
-        return OnSuccess();
-    }
-
-    template<typename T>
-    xUnitFailure Same(T *expected, T *actual, const LineInfo &lineInfo = LineInfo::empty()) const
-    {
-        if (expected != actual)
-        {
-            return OnFailure(xUnitAssert("Same", lineInfo));
-        }
-
-        return OnSuccess();
-    }
-
-    template<typename T>
-    xUnitFailure Same(const T *expected, const T *actual, const LineInfo &lineInfo = LineInfo::empty()) const
-    {
-        if (expected != actual)
-        {
-            return OnFailure(xUnitAssert("Same", lineInfo));
-        }
-
-        return OnSuccess();
-    }
-
-    Assert(const std::string &callPrefix = "Assert.",
-           std::function<void (const xUnitAssert &)> onFailure = [](const xUnitAssert &assert) { throw assert; });
+    Assert(std::string &&callPrefix = "Assert.",
+           std::function<void (const xUnitAssert &)> &&onFailure = [](const xUnitAssert &assert) { throw assert; });
 };
 
 const class : public Assert
 {
 public:
     template<typename TException, typename TFunc>
-    TException Throws(TFunc &&fn, const std::string &msg, const LineInfo &lineInfo = LineInfo::empty()) const
+    TException Throws(TFunc &&fn, const std::string &msg, LineInfo &&lineInfo = LineInfo()) const
     {
         try
         {
         }
         catch (const std::exception &e)
         {
-            throw xUnitAssert(callPrefix + "Throws", lineInfo)
+            throw xUnitAssert(callPrefix + "Throws", std::move(lineInfo))
                 .Expected(typeid(TException).name())
                 .Actual(e.what())
                 .AppendUserMessage(msg);
         }
         catch (...)
         {
-            throw xUnitAssert(callPrefix + "Throws", lineInfo)
+            throw xUnitAssert(callPrefix + "Throws", std::move(lineInfo))
                 .Expected(typeid(TException).name())
                 .Actual("Crash: unknown exception.")
                 .AppendUserMessage(msg);
         }
 
-        throw xUnitAssert(callPrefix + "Throws", lineInfo)
+        throw xUnitAssert(callPrefix + "Throws", std::move(lineInfo))
             .Expected(typeid(TException).name())
             .Actual("No exception.")
             .AppendUserMessage(msg);
     }
 
     template<typename TException, typename TFunc>
-    TException Throws(TFunc &&fn, const LineInfo &lineInfo = LineInfo::empty()) const
+    TException Throws(TFunc &&fn, LineInfo &&lineInfo = LineInfo()) const
     {
-        return Throws<TException>(std::forward<TFunc>(fn), "", lineInfo);
+        return Throws<TException>(std::forward<TFunc>(fn), "", std::move(lineInfo));
     }
 } Assert;
 
 }
 
-#endif
+#endif

File xUnit++/xUnit++/xUnitLog.h

         class Message
         {
         public:
-            Message(std::function<void(const std::string &, const LineInfo &)> recordMessage, const LineInfo &lineInfo = LineInfo::empty());
+            Message(std::function<void(const std::string &, const LineInfo &)> recordMessage, const LineInfo &lineInfo = LineInfo());
             Message(const Message &other);
             ~Message();
 

File xUnit++/xUnit++/xUnitMacros.h

         }; \
         void XU_UNIQUE_RUNNER() { XU_UNIQUE_FIXTURE().XU_UNIQUE_TEST(); } \
         xUnitpp::TestCollection::Register reg(xUnitpp::TestCollection::Instance(), \
-            &XU_UNIQUE_RUNNER, FactDetails, xUnitSuite::Name(), \
-            xUnitAttributes::Attributes(), timeout, __FILE__, __LINE__, eventRecorders); \
+            &XU_UNIQUE_RUNNER, std::string(FactDetails), xUnitSuite::Name(), \
+            xUnitAttributes::Attributes(), timeout, std::string(__FILE__), __LINE__, std::move(eventRecorders)); \
     } \
     void XU_UNIQUE_NS :: XU_UNIQUE_FIXTURE :: XU_UNIQUE_TEST()
 
         const xUnitpp::Log &Log = *detail::pLog; \
         void XU_UNIQUE_TEST params; \
         xUnitpp::TestCollection::Register reg(xUnitpp::TestCollection::Instance(), \
-            XU_UNIQUE_TEST, DataProvider, TheoryDetails, xUnitSuite::Name(), #params, \
-            xUnitAttributes::Attributes(), timeout, __FILE__, __LINE__, eventRecorders); \
+            &XU_UNIQUE_TEST, DataProvider, std::string(TheoryDetails), xUnitSuite::Name(), std::string(#params), \
+            xUnitAttributes::Attributes(), timeout, std::string(__FILE__), __LINE__, eventRecorders); \
     } \
     void XU_UNIQUE_NS :: XU_UNIQUE_TEST params
 
         void XU_UNIQUE_TEST params; \
         decltype(FIRST_ARG(__VA_ARGS__)) args[] = { __VA_ARGS__ }; \
         xUnitpp::TestCollection::Register reg(xUnitpp::TestCollection::Instance(), \
-            XU_UNIQUE_TEST, xUnitpp::TheoryData(PP_NARGS(__VA_ARGS__), args), TheoryDetails, \
-            xUnitSuite::Name(), #params, xUnitAttributes::Attributes(), timeout, __FILE__, __LINE__, eventRecorders); \
+            &XU_UNIQUE_TEST, xUnitpp::TheoryData(PP_NARGS(__VA_ARGS__), args), std::string(TheoryDetails), \
+            xUnitSuite::Name(), std::string(#params), xUnitAttributes::Attributes(), timeout, std::string(__FILE__), __LINE__, eventRecorders); \
     } \
     void XU_UNIQUE_NS :: XU_UNIQUE_TEST params
 
 
 #define THEORY(TheoryDetails, params, ...) TIMED_THEORY(TheoryDetails, params, -1, __VA_ARGS__)
 
-#define LI xUnitpp::LineInfo(__FILE__, __LINE__)
+#define LI xUnitpp::LineInfo(std::string(__FILE__), __LINE__)
 
 #endif

File xUnit++/xUnit++/xUnitTest.h

 class xUnitTest
 {
 public:
-    xUnitTest(std::function<void()> test, const std::string &name, const std::string &shortName,
+    xUnitTest(std::function<void()> &&test, std::string &&name, std::string &&shortName,
         const std::string &suite, const AttributeCollection &attributes, Time::Duration timeLimit,
-        const std::string &filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders);
+        std::string &&filename, int line, const std::vector<std::shared_ptr<TestEventRecorder>> &testEventRecorders);
 
     const xUnitpp::TestDetails &TestDetails() const;