Remove unused code:

* StringConcat was only being referenced by unit test.
* `runall.sh` is no longer needed. Use `npm test` instead.
This commit is contained in:
Edward Hennis
2014-08-07 19:09:30 -04:00
committed by Vinnie Falco
parent e3698b2a07
commit 1c73a0f649
5 changed files with 0 additions and 107 deletions

View File

@@ -1845,8 +1845,6 @@
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\utility\StringConcat.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\basics\utility\StringUtilities.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -2832,9 +2832,6 @@
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
<Filter>ripple\basics\utility</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\utility\StringConcat.h">
<Filter>ripple\basics\utility</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\basics\utility\StringUtilities.cpp">
<Filter>ripple\basics\utility</Filter>
</ClCompile>

View File

@@ -1,77 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_STRINGCONCAT_H
#define RIPPLE_STRINGCONCAT_H
#include <ripple/basics/utility/ToString.h>
namespace ripple {
namespace detail {
// ConcatArg is used to represent arguments to stringConcat.
struct ConcatArg {
ConcatArg(std::string const& s) : data_(s.data()), size_(s.size())
{
}
ConcatArg(char const* s) : data_(s), size_(strlen(s))
{
}
template <typename T>
ConcatArg(T t) : string_(to_string(t)),
data_(string_.data()),
size_(string_.size())
{
}
std::string string_;
char const* data_;
std::size_t size_;
};
} // namespace detail
/** Concatenate strings, numbers, bools and chars into one string in O(n) time.
Usage:
stringConcat({"hello ", 23, 'x', true});
Returns:
"hello 23xtrue"
*/
inline std::string stringConcat(std::vector<detail::ConcatArg> args)
{
int capacity = 0;
for (auto const& a: args)
capacity += a.size_;
std::string result;
result.reserve(capacity);
for (auto const& a: args)
result.append(a.data_, a.data_ + a.size_);
return result;
}
} // ripple
#endif

View File

@@ -24,7 +24,6 @@
#include <cstdarg>
#include <ripple/basics/utility/ToString.h>
#include <ripple/basics/utility/StringConcat.h>
namespace ripple {
@@ -393,25 +392,6 @@ public:
"parseUrl: Mixed://domain/path path failed");
}
void testStringConcat ()
{
testcase ("stringConcat");
auto result = stringConcat({});
expect(result == "", result);
result = stringConcat({"hello, ", std::string("world.")});
expect(result == "hello, world.", result);
result = stringConcat({"hello, ", 23});
expect(result == "hello, 23", result);
result = stringConcat({"hello, ", true});
expect(result == "hello, true", result);
result = stringConcat({"hello, ", 'x'});
expect(result == "hello, x", result);
}
void testToString ()
{
testcase ("toString");
@@ -423,7 +403,6 @@ public:
{
testParseUrl ();
testUnHex ();
testStringConcat ();
testToString ();
}
};

View File

@@ -1,4 +0,0 @@
#!/bin/bash
# flags set in mocha.opts
mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee}