/*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include "squid.h"
#include "sbuf/Algorithms.h"
-#include "sbuf/SBufList.h"
+#include "sbuf/List.h"
#include "tests/testSBufList.h"
#include "unitTestMain.h"
testSBufList::testSBufListJoin()
{
SBufList foo;
- CPPUNIT_ASSERT_EQUAL(SBuf(""),SBufContainerJoin(foo,SBuf()));
- CPPUNIT_ASSERT_EQUAL(SBuf(""),SBufContainerJoin(foo,SBuf()));
+ CPPUNIT_ASSERT_EQUAL(SBuf(""),JoinContainerToSBuf(foo.begin(), foo.end(),SBuf()));
for (int j = 0; j < sbuf_tokens_number; ++j)
foo.push_back(tokens[j]);
- SBuf joined=SBufContainerJoin(foo,SBuf(" "));
+ SBuf joined=JoinContainerToSBuf(foo.begin(), foo.end(),SBuf(" "));
CPPUNIT_ASSERT_EQUAL(literal,joined);
+ SBuf s1("1"), s2("2"), s3("3"), full("(1,2,3)");
+ SBufList sl {s1,s2,s3};
+ CPPUNIT_ASSERT_EQUAL(full, JoinContainerToSBuf(sl.begin(),
+ sl.end(), SBuf(","), SBuf("("), SBuf(")")));
+
+ CPPUNIT_ASSERT_EQUAL(SBuf(""),JoinContainerToSBuf(foo.begin(), foo.begin(),SBuf()));
+
}