String -> std::string, toString methods removed
This commit is contained in:
@@ -12,12 +12,22 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
|
||||
#include <pv/bitSet.h>
|
||||
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
|
||||
static string toString(BitSet& bitSet)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << bitSet;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
static void testGetSetClearFlip()
|
||||
{
|
||||
@@ -28,7 +38,7 @@ static void testGetSetClearFlip()
|
||||
testOk1(b1->isEmpty());
|
||||
testOk1(b1->cardinality() == 0);
|
||||
// to string check
|
||||
std::string str; b1->toString(&str);
|
||||
string str = toString(*b1);
|
||||
testOk1(str == "{}");
|
||||
|
||||
// one
|
||||
@@ -37,7 +47,7 @@ static void testGetSetClearFlip()
|
||||
testOk1(!b1->isEmpty());
|
||||
testOk1(b1->cardinality() == 1);
|
||||
// to string check
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{3}");
|
||||
|
||||
// grow
|
||||
@@ -45,34 +55,34 @@ static void testGetSetClearFlip()
|
||||
b1->set(67);
|
||||
b1->set(68);
|
||||
testOk1(b1->cardinality() == 4);
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{3, 66, 67, 68}");
|
||||
|
||||
// clear one
|
||||
b1->clear(67);
|
||||
testOk1(b1->cardinality() == 3);
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{3, 66, 68}");
|
||||
|
||||
// flip
|
||||
b1->flip(66);
|
||||
b1->flip(130);
|
||||
testOk1(b1->cardinality() == 3);
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{3, 68, 130}");
|
||||
|
||||
// flip
|
||||
b1->set(130, false);
|
||||
b1->set(4, true);
|
||||
testOk1(b1->cardinality() == 3);
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{3, 4, 68}");
|
||||
|
||||
// clear all
|
||||
b1->clear();
|
||||
testOk1(b1->isEmpty());
|
||||
testOk1(b1->cardinality() == 0);
|
||||
str.clear(); b1->toString(&str);
|
||||
str = toString(*b1);
|
||||
testOk1(str == "{}");
|
||||
|
||||
delete b1;
|
||||
@@ -101,11 +111,11 @@ static void testOperators()
|
||||
b2.set(106);
|
||||
b2.set(105);
|
||||
b1 |= b2;
|
||||
std::string str; b1.toString(&str);
|
||||
string str = toString(b1);
|
||||
testOk1(str == "{1, 65, 105, 106}");
|
||||
b1.clear();
|
||||
b1 |= b2;
|
||||
str.clear(); b1.toString(&str);
|
||||
str = toString(b1);
|
||||
testOk1(str == "{1, 65, 105, 106}");
|
||||
|
||||
// AND test
|
||||
@@ -134,7 +144,7 @@ static void testOperators()
|
||||
b2.clear(); b2.set(66); b2.set(128);
|
||||
BitSet b3; b3.set(128); b3.set(520);
|
||||
b1.or_and(b2, b3);
|
||||
str.clear(); b1.toString(&str);
|
||||
str = toString(b1);
|
||||
testOk1(str == "{2, 128}");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user