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}");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <pv/pvIntrospect.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
|
||||
void testBasicOperations() {
|
||||
@@ -197,7 +198,7 @@ void testBasicOperations() {
|
||||
testOk1(buff->getPosition()==6);
|
||||
testOk1(strncmp(&src[2],&dst[2],6)==0);
|
||||
|
||||
cout<<" First 10 characters of destination: >>"<<String(dst, 10)<<"<<\n";
|
||||
cout<<" First 10 characters of destination: >>"<<string(dst, 10)<<"<<\n";
|
||||
|
||||
delete buff;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <epicsAssert.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
@@ -28,8 +29,8 @@ static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
|
||||
void test()
|
||||
{
|
||||
String buffer;
|
||||
String properties("alarm,timeStamp,display");
|
||||
string buffer;
|
||||
string properties("alarm,timeStamp,display");
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,properties);
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
uint32 valueOffset = (uint32) pvValue->getFieldOffset();
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#define DOUBLE_MIN_VALUE std::numeric_limits<double>::min()
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -135,12 +136,10 @@ void serializationTest(PVFieldPtr const & field) {
|
||||
testPass("Serialization round trip OK");
|
||||
else {
|
||||
testFail("Serialization round trip did not match!");
|
||||
std::string buf;
|
||||
field->toString(&buf);
|
||||
testDiag("Expected: %s", buf.c_str());
|
||||
buf.clear();
|
||||
deserializedField->toString(&buf);
|
||||
testDiag("Found: %s", buf.c_str());
|
||||
std::ostringstream oss;
|
||||
oss << "Expected: " << *field << std::endl;
|
||||
oss << "Found : " << *deserializedField << std::endl;
|
||||
testDiag("Found: %s", oss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +299,7 @@ void testScalar() {
|
||||
serializationTest(pvString);
|
||||
|
||||
// huge string test
|
||||
pvString->put(String(10000, 'a'));
|
||||
pvString->put(string(10000, 'a'));
|
||||
serializationTest(pvString);
|
||||
}
|
||||
|
||||
@@ -347,7 +346,7 @@ static const float fdata[] = { (float)0.0, (float)1.1, (float)2.3, (float)-1.4,
|
||||
FLOAT_MAX_VALUE, FLOAT_MAX_VALUE-(float)123456.789,
|
||||
FLOAT_MIN_VALUE+(float)1.1, FLOAT_MIN_VALUE };
|
||||
|
||||
static const String sdata[] = {
|
||||
static const string sdata[] = {
|
||||
"",
|
||||
"a",
|
||||
"a b",
|
||||
@@ -355,7 +354,7 @@ static const String sdata[] = {
|
||||
"test",
|
||||
"smile",
|
||||
"this is a little longer string... maybe a little but longer... this makes test better",
|
||||
String(10000, 'b')
|
||||
string(10000, 'b')
|
||||
};
|
||||
|
||||
void testArray() {
|
||||
@@ -701,10 +700,10 @@ void testIntrospectionSerialization()
|
||||
}
|
||||
|
||||
void testStringCopy() {
|
||||
String s1 = "abc";
|
||||
String s2 = s1;
|
||||
string s1 = "abc";
|
||||
string s2 = s1;
|
||||
if (s1.c_str() != s2.c_str())
|
||||
testDiag("implementation of epics::pvData::String assignment operator does not share content");
|
||||
testDiag("implementation of string assignment operator does not share content");
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "pv/sharedVector.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
static void testEmpty()
|
||||
{
|
||||
testDiag("Test empty vector");
|
||||
@@ -376,7 +378,7 @@ static void testNonPOD()
|
||||
{
|
||||
testDiag("Test vector of non-POD types");
|
||||
|
||||
epics::pvData::shared_vector<std::string> strings(6);
|
||||
epics::pvData::shared_vector<string> strings(6);
|
||||
epics::pvData::shared_vector<std::tr1::shared_ptr<dummyStruct> > structs(5);
|
||||
|
||||
testOk1(strings[0].empty());
|
||||
@@ -406,7 +408,7 @@ static void testVectorConvert()
|
||||
|
||||
epics::pvData::shared_vector<int> ints(6, 42), moreints;
|
||||
epics::pvData::shared_vector<float> floats;
|
||||
epics::pvData::shared_vector<std::string> strings;
|
||||
epics::pvData::shared_vector<string> strings;
|
||||
epics::pvData::shared_vector<void> voids;
|
||||
|
||||
testOk1(ints.unique());
|
||||
@@ -435,7 +437,7 @@ static void testVectorConvert()
|
||||
// convert from void uses shared_vector<void>::original_type()
|
||||
// to find that the actual type is 'int'.
|
||||
// returns a new vector
|
||||
strings = epics::pvData::shared_vector_convert<std::string>(voids);
|
||||
strings = epics::pvData::shared_vector_convert<string>(voids);
|
||||
|
||||
voids.clear();
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
#include <pv/timeFunction.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
|
||||
static String actionName("action");
|
||||
static string actionName("action");
|
||||
|
||||
class Action;
|
||||
typedef std::tr1::shared_ptr<Action> ActionPtr;
|
||||
@@ -101,7 +102,7 @@ private:
|
||||
typedef std::tr1::shared_ptr<Basic> BasicPtr;
|
||||
|
||||
static void testBasic() {
|
||||
ExecutorPtr executor(new Executor(String("basic"),middlePriority));
|
||||
ExecutorPtr executor(new Executor(string("basic"),middlePriority));
|
||||
BasicPtr basic( new Basic(executor));
|
||||
basic->run();
|
||||
printf("testBasic PASSED\n");
|
||||
@@ -130,7 +131,7 @@ typedef std::tr1::shared_ptr<MyFunc> MyFuncPtr;
|
||||
#ifdef TESTTHREADCONTEXT
|
||||
|
||||
static void testThreadContext() {
|
||||
ExecutorPtr executor(new Executor(String("basic"),middlePriority));
|
||||
ExecutorPtr executor(new Executor(string("basic"),middlePriority));
|
||||
BasicPtr basic(new Basic(executor));
|
||||
MyFuncPtr myFunc(new MyFunc(basic));
|
||||
TimeFunctionPtr timeFunction(new TimeFunction(myFunc));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
@@ -25,6 +26,7 @@
|
||||
#include <pv/thread.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
|
||||
static TimeStamp currentTimeStamp;
|
||||
static double oneDelay = 4.0;
|
||||
@@ -39,7 +41,7 @@ typedef std::tr1::shared_ptr<MyCallback> MyCallbackPtr;
|
||||
class MyCallback : public TimerCallback {
|
||||
public:
|
||||
POINTER_DEFINITIONS(MyCallback);
|
||||
MyCallback(String name,EventPtr const & wait)
|
||||
MyCallback(string name,EventPtr const & wait)
|
||||
: name(name),
|
||||
wait(wait)
|
||||
{
|
||||
@@ -58,7 +60,7 @@ public:
|
||||
}
|
||||
TimeStamp &getTimeStamp() { return timeStamp;}
|
||||
private:
|
||||
String name;
|
||||
string name;
|
||||
EventPtr wait;
|
||||
TimeStamp timeStamp;
|
||||
};
|
||||
@@ -69,13 +71,13 @@ static void testBasic()
|
||||
printf("\n\ntestBasic oneDelay %lf twoDelay %lf threeDaley %lf\n",
|
||||
oneDelay,twoDelay,threeDelay);
|
||||
}
|
||||
String one("one");
|
||||
String two("two");
|
||||
String three("three");
|
||||
string one("one");
|
||||
string two("two");
|
||||
string three("three");
|
||||
EventPtr eventOne(new Event());
|
||||
EventPtr eventTwo(new Event());
|
||||
EventPtr eventThree(new Event());
|
||||
TimerPtr timer(new Timer(String("timer"),middlePriority));
|
||||
TimerPtr timer(new Timer(string("timer"),middlePriority));
|
||||
MyCallbackPtr callbackOne(new MyCallback(one,eventOne));
|
||||
MyCallbackPtr callbackTwo(new MyCallback(two,eventTwo));
|
||||
MyCallbackPtr callbackThree(new MyCallback(three,eventThree));
|
||||
@@ -91,9 +93,8 @@ static void testBasic()
|
||||
if(twoDelay>.1) testOk1(timer->isScheduled(callbackTwo));
|
||||
if(threeDelay>.1) testOk1(timer->isScheduled(callbackThree));
|
||||
if(debug) {
|
||||
String builder;
|
||||
timer->toString(&builder);
|
||||
printf("timerQueue\n%s",builder.c_str());
|
||||
std::cout << "timerQueue" << std::endl;
|
||||
std::cout << *timer;
|
||||
}
|
||||
eventOne->wait();
|
||||
eventTwo->wait();
|
||||
@@ -137,13 +138,13 @@ static void testCancel()
|
||||
printf("\n\ntestCancel oneDelay %lf twoDelay %lf threeDaley %lf\n",
|
||||
oneDelay,twoDelay,threeDelay);
|
||||
}
|
||||
String one("one");
|
||||
String two("two");
|
||||
String three("three");
|
||||
string one("one");
|
||||
string two("two");
|
||||
string three("three");
|
||||
EventPtr eventOne(new Event());
|
||||
EventPtr eventTwo(new Event());
|
||||
EventPtr eventThree(new Event());
|
||||
TimerPtr timer(new Timer(String("timer"),middlePriority));
|
||||
TimerPtr timer(new Timer(string("timer"),middlePriority));
|
||||
MyCallbackPtr callbackOne(new MyCallback(one,eventOne));
|
||||
MyCallbackPtr callbackTwo(new MyCallback(two,eventTwo));
|
||||
MyCallbackPtr callbackThree(new MyCallback(three,eventThree));
|
||||
@@ -160,9 +161,8 @@ static void testCancel()
|
||||
testOk1(!timer->isScheduled(callbackTwo));
|
||||
if(threeDelay>.1) testOk1(timer->isScheduled(callbackThree));
|
||||
if(debug) {
|
||||
String builder;
|
||||
timer->toString(&builder);
|
||||
printf("timerQueue\n%s",builder.c_str());
|
||||
std::cout << "timerQueue" << std::endl;
|
||||
std::cout << *timer;
|
||||
}
|
||||
eventOne->wait();
|
||||
eventThree->wait();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "pv/typeCast.h"
|
||||
|
||||
using epics::pvData::String;
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -131,11 +131,11 @@ try {
|
||||
uint64_t xuint64=0;
|
||||
float xfloat=0.0;
|
||||
double xdouble=0.0;
|
||||
epics::pvData::String xString("0");
|
||||
string xstring("0");
|
||||
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
typedef epics::pvData::String String_t;
|
||||
typedef string string_t;
|
||||
|
||||
// force all possibilities to be compiled
|
||||
#define CHECK(M, N) x## M = ::epics::pvData::castUnsafe<M ##_t>(x## N); \
|
||||
@@ -151,7 +151,7 @@ try {
|
||||
CHECK(int8, uint64);
|
||||
CHECK(int8, float);
|
||||
CHECK(int8, double);
|
||||
CHECK(int8, String);
|
||||
CHECK(int8, string);
|
||||
|
||||
CHECK(uint8, int8);
|
||||
CHECK(uint8, uint8);
|
||||
@@ -163,7 +163,7 @@ try {
|
||||
CHECK(uint8, uint64);
|
||||
CHECK(uint8, float);
|
||||
CHECK(uint8, double);
|
||||
CHECK(uint8, String);
|
||||
CHECK(uint8, string);
|
||||
|
||||
CHECK(int16, int8);
|
||||
CHECK(int16, uint8);
|
||||
@@ -175,7 +175,7 @@ try {
|
||||
CHECK(int16, uint64);
|
||||
CHECK(int16, float);
|
||||
CHECK(int16, double);
|
||||
CHECK(int16, String);
|
||||
CHECK(int16, string);
|
||||
|
||||
CHECK(uint16, int8);
|
||||
CHECK(uint16, uint8);
|
||||
@@ -187,7 +187,7 @@ try {
|
||||
CHECK(uint16, uint64);
|
||||
CHECK(uint16, float);
|
||||
CHECK(uint16, double);
|
||||
CHECK(uint16, String);
|
||||
CHECK(uint16, string);
|
||||
|
||||
CHECK(int32, int8);
|
||||
CHECK(int32, uint8);
|
||||
@@ -199,7 +199,7 @@ try {
|
||||
CHECK(int32, uint64);
|
||||
CHECK(int32, float);
|
||||
CHECK(int32, double);
|
||||
CHECK(int32, String);
|
||||
CHECK(int32, string);
|
||||
|
||||
CHECK(uint32, int8);
|
||||
CHECK(uint32, uint8);
|
||||
@@ -211,7 +211,7 @@ try {
|
||||
CHECK(uint32, uint64);
|
||||
CHECK(uint32, float);
|
||||
CHECK(uint32, double);
|
||||
CHECK(uint32, String);
|
||||
CHECK(uint32, string);
|
||||
|
||||
CHECK(int64, int8);
|
||||
CHECK(int64, uint8);
|
||||
@@ -223,7 +223,7 @@ try {
|
||||
CHECK(int64, uint64);
|
||||
CHECK(int64, float);
|
||||
CHECK(int64, double);
|
||||
//CHECK(int64, String);
|
||||
//CHECK(int64, string);
|
||||
|
||||
CHECK(uint64, int8);
|
||||
CHECK(uint64, uint8);
|
||||
@@ -235,7 +235,7 @@ try {
|
||||
CHECK(uint64, uint64);
|
||||
CHECK(uint64, float);
|
||||
CHECK(uint64, double);
|
||||
//CHECK(uint64, String);
|
||||
//CHECK(uint64, string);
|
||||
|
||||
CHECK(float, int8);
|
||||
CHECK(float, uint8);
|
||||
@@ -247,7 +247,7 @@ try {
|
||||
CHECK(float, uint64);
|
||||
CHECK(float, float);
|
||||
CHECK(float, double);
|
||||
CHECK(float, String);
|
||||
CHECK(float, string);
|
||||
|
||||
CHECK(double, int8);
|
||||
CHECK(double, uint8);
|
||||
@@ -259,19 +259,19 @@ try {
|
||||
CHECK(double, uint64);
|
||||
CHECK(double, float);
|
||||
CHECK(double, double);
|
||||
CHECK(double, String);
|
||||
CHECK(double, string);
|
||||
|
||||
CHECK(String, int8);
|
||||
CHECK(String, uint8);
|
||||
CHECK(String, int16);
|
||||
CHECK(String, uint16);
|
||||
CHECK(String, int32);
|
||||
CHECK(String, uint32);
|
||||
CHECK(String, int64);
|
||||
CHECK(String, uint64);
|
||||
CHECK(String, float);
|
||||
CHECK(String, double);
|
||||
CHECK(String, String);
|
||||
CHECK(string, int8);
|
||||
CHECK(string, uint8);
|
||||
CHECK(string, int16);
|
||||
CHECK(string, uint16);
|
||||
CHECK(string, int32);
|
||||
CHECK(string, uint32);
|
||||
CHECK(string, int64);
|
||||
CHECK(string, uint64);
|
||||
CHECK(string, float);
|
||||
CHECK(string, double);
|
||||
CHECK(string, string);
|
||||
#undef CHECK
|
||||
|
||||
testDiag("Integer signed <=> unsigned");
|
||||
@@ -309,91 +309,91 @@ try {
|
||||
TEST(int32_t, -2, float, -2.5f);
|
||||
TEST(int32_t, -2, float, -2.7f);
|
||||
|
||||
testDiag("String Printing/parsing");
|
||||
testDiag("string Printing/parsing");
|
||||
|
||||
TEST2(String, "1", int32_t, 1);
|
||||
TEST2(String, "-1", int32_t, -1);
|
||||
TEST2(String, "1", int8_t, 1);
|
||||
TEST2(String, "-1", int8_t, -1);
|
||||
TEST2(String, "1", uint8_t, 1);
|
||||
TEST2(string, "1", int32_t, 1);
|
||||
TEST2(string, "-1", int32_t, -1);
|
||||
TEST2(string, "1", int8_t, 1);
|
||||
TEST2(string, "-1", int8_t, -1);
|
||||
TEST2(string, "1", uint8_t, 1);
|
||||
|
||||
TEST2(String, "127", int32_t, std::numeric_limits<int8_t>::max());
|
||||
TEST2(String, "-128", int32_t, std::numeric_limits<int8_t>::min());
|
||||
TEST2(String, "255", int32_t, std::numeric_limits<uint8_t>::max());
|
||||
TEST2(string, "127", int32_t, std::numeric_limits<int8_t>::max());
|
||||
TEST2(string, "-128", int32_t, std::numeric_limits<int8_t>::min());
|
||||
TEST2(string, "255", int32_t, std::numeric_limits<uint8_t>::max());
|
||||
|
||||
TEST2(String, "32767", int32_t, std::numeric_limits<int16_t>::max());
|
||||
TEST2(String, "-32768", int32_t, std::numeric_limits<int16_t>::min());
|
||||
TEST2(String, "65535", int32_t, std::numeric_limits<uint16_t>::max());
|
||||
TEST2(string, "32767", int32_t, std::numeric_limits<int16_t>::max());
|
||||
TEST2(string, "-32768", int32_t, std::numeric_limits<int16_t>::min());
|
||||
TEST2(string, "65535", int32_t, std::numeric_limits<uint16_t>::max());
|
||||
|
||||
TEST2(String, "2147483647", int32_t, std::numeric_limits<int32_t>::max());
|
||||
TEST2(String, "-2147483648", int32_t, std::numeric_limits<int32_t>::min());
|
||||
TEST2(String, "4294967295", uint32_t, std::numeric_limits<uint32_t>::max());
|
||||
TEST2(string, "2147483647", int32_t, std::numeric_limits<int32_t>::max());
|
||||
TEST2(string, "-2147483648", int32_t, std::numeric_limits<int32_t>::min());
|
||||
TEST2(string, "4294967295", uint32_t, std::numeric_limits<uint32_t>::max());
|
||||
|
||||
TEST2(String, "9223372036854775807", int64_t, std::numeric_limits<int64_t>::max());
|
||||
TEST2(String, "-9223372036854775808", int64_t, std::numeric_limits<int64_t>::min());
|
||||
TEST2(String, "18446744073709551615", uint64_t, std::numeric_limits<uint64_t>::max());
|
||||
TEST2(string, "9223372036854775807", int64_t, std::numeric_limits<int64_t>::max());
|
||||
TEST2(string, "-9223372036854775808", int64_t, std::numeric_limits<int64_t>::min());
|
||||
TEST2(string, "18446744073709551615", uint64_t, std::numeric_limits<uint64_t>::max());
|
||||
|
||||
TEST2(String, "1.1", double, 1.1);
|
||||
TEST2(String, "1.1e+100", double, 1.1e100);
|
||||
TEST2(String, "1.1e-100", double, 1.1e-100);
|
||||
TEST2(string, "1.1", double, 1.1);
|
||||
TEST2(string, "1.1e+100", double, 1.1e100);
|
||||
TEST2(string, "1.1e-100", double, 1.1e-100);
|
||||
|
||||
TEST(double, 1.1e100, String, "1.1E+100");
|
||||
TEST(double, 1.1e100, string, "1.1E+100");
|
||||
|
||||
// any non-zero value is true
|
||||
TEST(String, "true", epics::pvData::boolean, 100);
|
||||
TEST(string, "true", epics::pvData::boolean, 100);
|
||||
|
||||
TEST2(String, "true", epics::pvData::boolean, 1);
|
||||
TEST2(String, "false", epics::pvData::boolean, 0);
|
||||
TEST2(string, "true", epics::pvData::boolean, 1);
|
||||
TEST2(string, "false", epics::pvData::boolean, 0);
|
||||
|
||||
// Case insensitive
|
||||
TEST(epics::pvData::boolean, 1, String, "True");
|
||||
TEST(epics::pvData::boolean, 0, String, "False");
|
||||
TEST(epics::pvData::boolean, 1, String, "TRUE");
|
||||
TEST(epics::pvData::boolean, 0, String, "FALSE");
|
||||
TEST(epics::pvData::boolean, 1, string, "True");
|
||||
TEST(epics::pvData::boolean, 0, string, "False");
|
||||
TEST(epics::pvData::boolean, 1, string, "TRUE");
|
||||
TEST(epics::pvData::boolean, 0, string, "FALSE");
|
||||
|
||||
testDiag("String Parsing");
|
||||
testDiag("string Parsing");
|
||||
|
||||
TEST(int32_t, 15, String, "0xf");
|
||||
TEST(int32_t, 15, String, "0xF");
|
||||
TEST(int32_t, -15, String, "-0xF");
|
||||
TEST(int32_t, 16, String, "0x10");
|
||||
TEST(int32_t, -16, String, "-0x10");
|
||||
TEST(int32_t, 15, string, "0xf");
|
||||
TEST(int32_t, 15, string, "0xF");
|
||||
TEST(int32_t, -15, string, "-0xF");
|
||||
TEST(int32_t, 16, string, "0x10");
|
||||
TEST(int32_t, -16, string, "-0x10");
|
||||
|
||||
TEST(int32_t, 7, String, "07");
|
||||
TEST(int32_t, 8, String, "010");
|
||||
TEST(int32_t, -7, String, "-07");
|
||||
TEST(int32_t, -8, String, "-010");
|
||||
TEST(int32_t, 7, string, "07");
|
||||
TEST(int32_t, 8, string, "010");
|
||||
TEST(int32_t, -7, string, "-07");
|
||||
TEST(int32_t, -8, string, "-010");
|
||||
|
||||
TEST(int64_t, 15, String, "0xf");
|
||||
TEST(int64_t, 15, String, "0xF");
|
||||
TEST(int64_t, -15, String, "-0xF");
|
||||
TEST(int64_t, 16, String, "0x10");
|
||||
TEST(int64_t, -16, String, "-0x10");
|
||||
TEST(int64_t, 15, string, "0xf");
|
||||
TEST(int64_t, 15, string, "0xF");
|
||||
TEST(int64_t, -15, string, "-0xF");
|
||||
TEST(int64_t, 16, string, "0x10");
|
||||
TEST(int64_t, -16, string, "-0x10");
|
||||
|
||||
TEST(int64_t, 7, String, "07");
|
||||
TEST(int64_t, 8, String, "010");
|
||||
TEST(int64_t, -7, String, "-07");
|
||||
TEST(int64_t, -8, String, "-010");
|
||||
TEST(int64_t, 7, string, "07");
|
||||
TEST(int64_t, 8, string, "010");
|
||||
TEST(int64_t, -7, string, "-07");
|
||||
TEST(int64_t, -8, string, "-010");
|
||||
|
||||
testDiag("String parsing errors");
|
||||
testDiag("string parsing errors");
|
||||
|
||||
FAIL(int32_t, String, "hello!");
|
||||
FAIL(int32_t, String, "42 is the answer");
|
||||
FAIL(int64_t, String, "hello!");
|
||||
FAIL(int64_t, String, "42 is the answer");
|
||||
FAIL(double, String, "hello!");
|
||||
FAIL(double, String, "42 is the answer");
|
||||
FAIL(int32_t, string, "hello!");
|
||||
FAIL(int32_t, string, "42 is the answer");
|
||||
FAIL(int64_t, string, "hello!");
|
||||
FAIL(int64_t, string, "42 is the answer");
|
||||
FAIL(double, string, "hello!");
|
||||
FAIL(double, string, "42 is the answer");
|
||||
|
||||
FAIL(int8_t, String, "1000");
|
||||
FAIL(int8_t, String, "-1000");
|
||||
FAIL(int8_t, string, "1000");
|
||||
FAIL(int8_t, string, "-1000");
|
||||
|
||||
FAIL(double, String, "1e+10000000");
|
||||
FAIL(double, string, "1e+10000000");
|
||||
|
||||
FAIL(epics::pvData::boolean, String, "hello");
|
||||
FAIL(epics::pvData::boolean, String, "1");
|
||||
FAIL(epics::pvData::boolean, String, "0");
|
||||
FAIL(epics::pvData::boolean, String, "T");
|
||||
FAIL(epics::pvData::boolean, String, "F");
|
||||
FAIL(epics::pvData::boolean, string, "hello");
|
||||
FAIL(epics::pvData::boolean, string, "1");
|
||||
FAIL(epics::pvData::boolean, string, "0");
|
||||
FAIL(epics::pvData::boolean, string, "T");
|
||||
FAIL(epics::pvData::boolean, string, "F");
|
||||
|
||||
testDiag("Floating point overflows");
|
||||
|
||||
@@ -406,10 +406,10 @@ try {
|
||||
testOk(isnan( xfloat ), "Test cast double NAN to float NAN yields: %f", xfloat);
|
||||
|
||||
{
|
||||
std::string result[3];
|
||||
string result[3];
|
||||
const int32_t in[3] = { 1234, 506001, 42424242 };
|
||||
|
||||
testDiag("Test vcast int32 -> String");
|
||||
testDiag("Test vcast int32 -> string");
|
||||
epics::pvData::castUnsafeV(3, epics::pvData::pvString, (void*)result,
|
||||
epics::pvData::pvInt, (void*)in);
|
||||
testDiag("Yields %s %s %s", result[0].c_str(), result[1].c_str(), result[2].c_str());
|
||||
|
||||
Reference in New Issue
Block a user