示例#1
0
static void dumpFormat(AudioStreamBasicDescription *fmt)
{
  UInt32 flags= fmt->mFormatFlags;

  printf("  sample rate         %g\n",	fmt->mSampleRate);
  printf("  format              %s\n",  str4(fmt->mFormatID));
  printf("  flags               %08lx",	flags);

  if	  (flags & kAudioFormatFlagIsBigEndian)		printf(" big-endian");
  else							printf(" little-endian");

  if	  (flags & kAudioFormatFlagIsFloat)		printf(" float");
  else if (flags & kAudioFormatFlagIsSignedInteger)	printf(" signed-int");
  else							printf(" unsigned-int");

  if	  (flags & kAudioFormatFlagIsPacked)		printf(" packed");
  else if (flags & kAudioFormatFlagIsAlignedHigh)	printf(" aligned-high");
  else							printf(" aligned-low");

  if	  (flags & kAudioFormatFlagIsNonInterleaved)	printf(" interleaved");
  else							printf(" non-interleaved");
  printf("\n");

  printf("  bytes per packet    %ld\n",	fmt->mBytesPerPacket);
  printf("  frames per packet   %ld\n",	fmt->mFramesPerPacket);
  printf("  channels per frame  %ld\n",	fmt->mChannelsPerFrame);
  printf("  bytes per frame     %ld\n",	fmt->mBytesPerFrame);
  printf("  bits per channel    %ld\n",	fmt->mBitsPerChannel);
}
bool OTTransactionType::VerifyContractID()
{	
	//m_AcctID contains the number we read from the xml file
	//we can compare it to the existing and actual identifier.
	
	// m_AcctID  contains the "IDENTIFIER" of the object, according to the xml file. 
	// 
	// Meanwhile m_ID contains the same identifier, except it was generated.
	//
	// Now let's compare the two and make sure they match...
	
	// Also, for this class, we compare ServerID as well.  They go hand in hand.
	
	if ((m_ID		!= m_AcctID)		|| 
		(m_ServerID	!= m_AcctServerID))
	{		
		OTString str1(m_ID), str2(m_AcctID), str3(m_ServerID), str4(m_AcctServerID);
		OTLog::vError("Identifiers do NOT match in OTTransactionType::VerifyContractID.\n"
				"m_ID: %s\n m_AcctID: %s\n m_ServerID: %s\n m_AcctServerID: %s\n",
				str1.Get(), str2.Get(), str3.Get(), str4.Get());
        
//        OT_FAIL;  // I was debugging.
        
		return false;
	}
	else 
	{
//		OTString str1(m_AcctID), str2(m_AcctServerID);
//		OTLog::vError("Expected Account ID and Server ID both *SUCCESSFUL* match to "
//				"IDs in the xml:\n Account ID:\n%s\n ServerID:\n%s\n"
//				"-----------------------------------------------------------------------------\n",
//				str1.Get(), str2.Get());
		return true;
	}
}
示例#3
0
int main()
{
    std::cout<< "hello, this is mystring plugin" << std::endl;

    MyString str0("AAA");
    std::cout << "str0="<< str0 << std::endl;

    MyString str1(NULL);
    std::cout << "str1="<< str1 << std::endl;

    //MyString str2; // compile error, cause lacking of default constructor
    //std::cout << "str2="<< str2 << std::endl;

    str0 += "BBB";
    std::cout << "str0="<< str0 << std::endl;

    MyString str3("CCC");
    str0 += str3;
    std::cout << "str0="<< str0 << std::endl;

    MyString str4("DDD");
    MyString str5("DDD");
    std::cout << "str4==str5:"<< ((str4==str5)? "true":"false") << std::endl;

    std::vector<MyString> vec;
    vec.push_back(MyString("aaa"));
    vec.push_back(MyString("bbb"));
    std::cout << "vec:"<< vec[0] << ", " << vec[1] << std::endl;

    return 0;
}
示例#4
0
static inline int checkError(OSStatus err, char *op, char *param)
{
  if (kAudioHardwareNoError != noErr)
    {
      eprintf("sound: %s(%s): error %ld (%s)\n", op, param, err, str4(err));
      return 1;
    }
  return 0;
}
示例#5
0
int CTest::test_caseInsensitiveButCasePreserving(int argc, char* argv[])
{
    AutoPtr<IRawHeaders> h;
    CRawHeaders::New((IRawHeaders**)&h);
    String str0("Content-Type");
    String str1("text/plain");
    h->Add(str0, str1);
    // Case-insensitive:
    String strOut;
    h->Get(str0, &strOut);
    Boolean flag = strOut.Equals(str1);
    assert(flag == TRUE);

    String str2("Content-type");
    h->Get(str2, &strOut);
    flag = strOut.Equals(str1);
    assert(flag == TRUE);

    String str3("content-type");
    h->Get(str3, &strOut);
    flag = strOut.Equals(str1);
    assert(flag == TRUE);

    String str4("CONTENT-TYPE");
    h->Get(str4, &strOut);
    flag = strOut.Equals(str1);
    assert(flag == TRUE);

    // ...but case-preserving:
    AutoPtr<IMap> innerMap;
    h->ToMultimap((IMap**)&innerMap);
    AutoPtr<ISet> keyset;
    innerMap->KeySet((ISet**)&keyset);
    AutoPtr<ArrayOf<IInterface*> > array;
    keyset->ToArray((ArrayOf<IInterface*>**)&array);
    AutoPtr<ICharSequence> cs = (ICharSequence*)ICharSequence::Probe((*array)[0]);
    String str5(String("Content-Type"));
    cs->ToString(&strOut);
    flag = strOut.Equals(str5);
    assert(flag == TRUE);

    // We differ from the RI in that the Map we return is also case-insensitive.
    // Our behavior seems more consistent. (And code that works on the RI will work on Android.)
    // AutoPtr<ICharSequence> cs1;
    // CString::New(String("Content-Type"), (ICharSequence**)&cs1);
    // AutoPtr<IInterface> value;
    // innerMap->Get(cs1, (IInterface**)&value);
    // assertEquals(Arrays.asList("text/plain"), h.toMultimap().get("Content-Type"));
    // assertEquals(Arrays.asList("text/plain"), h.toMultimap().get("Content-type")); // RI fails this.
}
TEST(SimpleString, endsWith)
{
	SimpleString str("Hello World");
	CHECK(str.endsWith("World"));
	CHECK(!str.endsWith("Worl"));
	CHECK(!str.endsWith("Hello"));
	SimpleString str2("ah");
	CHECK(str2.endsWith("ah"));
	CHECK(!str2.endsWith("baah"));
	SimpleString str3("");
	CHECK(!str3.endsWith("baah"));

	SimpleString str4("ha ha ha ha");
	CHECK(str4.endsWith("ha"));
}
示例#7
0
int main(int argc, char const *argv[])
{

	std::string message = std::string("c++ string");
	printf("%s\n", message.c_str());

	message = "hello string";
	std::cout << message << std::endl;


	char ch = 'c';  
    std::string str4(5, ch);
    std::cout << str4 << std::endl; 

	return 0;
}
示例#8
0
	void testCountASCIIChars()
	{
		vmime::string str1("foo");
		VASSERT_EQ("1", static_cast <vmime::string::size_type>(3),
			stringUtils::countASCIIchars(str1.begin(), str1.end()));

		vmime::string str2("f=?oo");
		VASSERT_EQ("2", static_cast <vmime::string::size_type>(3 + 1),
			stringUtils::countASCIIchars(str2.begin(), str2.end()));

		vmime::string str3("foo\x7f");
		VASSERT_EQ("3", static_cast <vmime::string::size_type>(4),
			stringUtils::countASCIIchars(str3.begin(), str3.end()));

		vmime::string str4("foo\x80");
		VASSERT_EQ("4", static_cast <vmime::string::size_type>(3),
			stringUtils::countASCIIchars(str4.begin(), str4.end()));
	}
示例#9
0
int main(int argc, char *argv[])
{
  // BinaryCode *bc = new BinaryCode();
  auto_ptr<BinaryCode> bc (new BinaryCode());
  string str1 ("123210122");
  vector<string> str1Response = bc->decode(str1);
  cout << "Dla stringa: " << str1 << endl;
  cout << "Pierwsza wartość: " << str1Response[0] << endl;
  cout << "Druga wartość: " << str1Response[1] << endl << endl;
  
  string str2 ("11");
  vector<string> str2Response = bc->decode(str2);
  cout << "Dla stringa: " << str2 << endl;
  cout << "Pierwsza wartość: " << str2Response[0] << endl;
  cout << "Druga wartość: " << str2Response[1] << endl << endl;;
  
  string str3 ("22111");
  vector<string> str3Response = bc->decode(str3);
  cout << "Dla stringa: " << str3 << endl;
  cout << "Pierwsza wartość: " << str3Response[0] << endl;
  cout << "Druga wartość: " << str3Response[1] << endl << endl;;
  
  string str4 ("123210120");
  vector<string> str4Response = bc->decode(str4);
  cout << "Dla stringa: " << str4 << endl;
  cout << "Pierwsza wartość: " << str4Response[0] << endl;
  cout << "Druga wartość: " << str4Response[1] << endl << endl;;
  
  string str5 ("3");
  vector<string> str5Response = bc->decode(str5);
  cout << "Dla stringa: " << str5 << endl;
  cout << "Pierwsza wartość: " << str5Response[0] << endl;
  cout << "Druga wartość: " << str5Response[1] << endl << endl;;
  
  string str6 ("12221112222221112221111111112221111");
  vector<string> str6Response = bc->decode(str6);
  cout << "Dla stringa: " << str6 << endl;
  cout << "Pierwsza wartość: " << str6Response[0] << endl;
  cout << "Druga wartość: " << str6Response[1] << endl << endl;;
  return 0;
}
示例#10
0
int main ()
{
  std::string str1 ("/usr/bin/man");
  std::string str2 ("c:\\windows\\winhelp.exe");
  std::string str3 ("woman");
  std::string str4 ("/hello");

  SplitFilename (str1);
  std::cout << " newfile " << str1 << '\n';

  SplitFilename (str2);
  std::cout << " newfile " << str2 << '\n';

  SplitFilename (str3);
  std::cout << " newfile " << str3 << '\n';

  SplitFilename (str4);
  std::cout << " newfile " << str4 << '\n';

  return 0;
}
示例#11
0
文件: post.cpp 项目: dmsTest/dms
void post::pushB1_clicked()
{
    client.dataMine();
    list<MLogRec> logList_temp= logreader.getLogList();
    list<MLogRec>::iterator it=logList_temp.begin();
    while(it!=logList_temp.end()){
        QString str1(it->logname);
        QString str2(it->logip);
        int pid=it->pid;
        QString str3(QString::number(pid));
        long logintime=it->logintime;
        QString str4(QString::number(logintime));
        long logouttime=it->logouttime;
        QString str5(QString::number(logouttime));
        long logtime=it->logtime;
        QString str6(QString::number(logtime));
        QString str=str1+"  "+str2+"  "+str3+"  "+str4+"  "+str5+"  "+str6+'\n';
        ui->textEdit->append(str);
        it++;
    }
    ui->textEdit->append("***************************Send data over!***********************");
    ui->textEdit->append("total:"+QString::number(logList_temp.size()));

}
/*  the gateway routine.  */
void mexFunction( int nlhs, mxArray *plhs[],
        int nrhs, const mxArray *prhs[] )
{
    
    /* create a pointer to the real data in the input matrix  */
    int nfields = mxGetNumberOfFields(prhs[0]); // number of fields in each constraint
    mwSize NStructElems = mxGetNumberOfElements(prhs[0]); // number of constraints
    const char **fnames = (const char **)mxCalloc(nfields, sizeof(*fnames)); /* pointers to field names */
    double *sw = mxGetPr(prhs[1]); /* switch vector */ 
    double *xs = mxGetPr(prhs[2]); /* linearisation point */
    long unsigned int nrow = mxGetM(prhs[2]);
    double *ptr = mxGetPr(prhs[3]); /* number of cameras */
    int ncams = ptr[0];
    
    /* initialise a PwgOptimiser object */
    PwgOptimiser *Object; // pointer initialisation
    Object = new PwgOptimiser (ncams, nrow-6*ncams) ; // pointer initialisation
    
    /* get constraints from Matlab to C++ and initialise a constraint */
    double *pr;
    mxArray *tmp;
    int cam, kpt;
    std::vector<double> p1(2), z(2), R(4,0.0);//, Y(49,0.0), y(7,0.0);
    std::string str1 ("cam");
    std::string str2 ("kpt");
    std::string str3 ("p1");
    std::string str4 ("z");
    std::string str5 ("R");
    std::string str6 ("y");
    std::string str7 ("Y");
    Eigen::MatrixXd yz = Eigen::MatrixXd::Zero(7,1);
    Eigen::VectorXd Yz = Eigen::MatrixXd::Zero(7,7);
    for (mwIndex jstruct = 0; jstruct < NStructElems; jstruct++) { /* loop the constraints */
        for (int ifield = 0; ifield < nfields; ifield++) {  /* loop the fields */
            fnames[ifield] = mxGetFieldNameByNumber(prhs[0],ifield); // get field name
            tmp = mxGetFieldByNumber(prhs[0], jstruct, ifield); // get field
            pr = (double *)mxGetData(tmp); // get the field data pointer
            if (str1.compare(fnames[ifield]) == 0) // cam
                cam = pr[0];
            if (str2.compare(fnames[ifield]) == 0) // kpt
                kpt = pr[0];
            if (str3.compare(fnames[ifield]) == 0){ // p1
                p1[0] = pr[0]; p1[1] = pr[1];}
            if (str4.compare(fnames[ifield]) == 0){ // z
                z[0] = pr[0]; z[1] = pr[1];}
            if (str5.compare(fnames[ifield]) == 0){ // R
                R[0] = pr[0]; R[3] = pr[3];}
        } // end of nfields loop
        Object->initialise_a_constraint(cam, kpt, p1, z, R, Yz, yz, (int)sw[jstruct]) ; // using pointer to object
    } // end of NStructElems loop
    
    // optimise constraints information
    Object->optimise_constraints_image_inverse_depth_Mviews( xs ) ;
            
    /* get output state vector */
    int ncol = (Object->xhat).size();
    plhs[0] = mxCreateDoubleMatrix(ncol, 1, mxREAL);
    double *vec_out = mxGetPr(plhs[0]);
    for (int i=0; i<ncol; i++)
        vec_out[i] = (Object->xhat).coeffRef(i);
    
    /* get output sparse covariance matrix */
    ncol = (Object->Phat).outerSize();
    long unsigned int nzmax = (Object->Phat).nonZeros();
    plhs[1] = mxCreateSparse(ncol, ncol, nzmax, mxREAL);
    double *mat_out = mxGetPr(plhs[1]);
    long unsigned int *ir2 = mxGetIr(plhs[1]);
    long unsigned int *jc2 = mxGetJc(plhs[1]);
    int index=0;
    for (int k=0; k < (Object->Phat).outerSize(); ++k)
    {
        jc2[k] = index;
        for (Eigen::SparseMatrix<double>::InnerIterator it(Object->Phat,k); it; ++it)
        {
            ir2[index] = it.row();
            mat_out[index] = it.value();
            index++;
        }
    }
    jc2[(Object->Phat).outerSize()] = index;
    
    /* Free memory */
    mxFree((void *)fnames);
    delete Object; // delete class pointer
    //mxFree(tmp);
}
示例#13
0
int
make_labl(int fd)
{
	printf("making LABL...\n");

	memset((char *)buffer, 0, sizeof(buffer));

	buffer[0] = str4("LABL");	/* label LABL */
	buffer[1] = 1;			/* version = 1 */
	buffer[2] = cyls;		/* # cyls */
	buffer[3] = heads;		/* # heads */
	buffer[4] = blocks_per_track;	/* # blocks */
	buffer[5] = heads*blocks_per_track; /* heads*blocks */
	buffer[6] = str4(mcr_name);	/* name of micr part */
	buffer[7] = str4(lod_name);	/* name of load part */

	{
		int i;
		int p = 0200;
		
		printf("%d partitions\n", part_count);

		buffer[p++] = part_count; /* # of partitions */
		buffer[p++] = 7; /* words / partition */

		for (i = 0; i < part_count; i++) {
			unsigned long n;
			char *pn = parts[i].name;

			printf("%s, start %o, size %o\n",
			       pn, parts[i].start, parts[i].size);

			n = str4(pn);

			buffer[p++] = n;
			buffer[p++] = parts[i].start;
			buffer[p++] = parts[i].size;
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");

		}
	}

//#define LABEL_PAD_CHAR '\200'
#define LABEL_PAD_CHAR '\0'
	/* pack brand text - offset 010, 32 bytes */
	memset((char *)&buffer[010], LABEL_PAD_CHAR, 32);
	if (brand) {
		memcpy((char *)&buffer[010], brand, strlen(brand)+1);
		printf("brand: '%s'\n", brand);
	}

	/* pack text label - offset 020, 32 bytes */
	memset((char *)&buffer[020], ' ', 32);
	memcpy((char *)&buffer[020], text, strlen(text)+1);
	printf("text: '%s'\n", text);

	/* comment - offset 030, 32 bytes */
	memset((char *)&buffer[030], LABEL_PAD_CHAR, 32);
	strcpy((char *)&buffer[030], comment);
	printf("comment: '%s'\n", comment);

#ifdef NEED_SWAP
	/* don't swap the text */
	_swaplongbytes(&buffer[0], 8);
	_swaplongbytes(&buffer[0200], 128);
#endif

	if (write(fd, buffer, 256*4) != 256*4)
		return -1;

	return 0;
}
示例#14
0
void drive_operation()
{

    // Uint64 tests

    CQLValue a1(Uint64(10));
    CQLValue a2(Uint64(15));
    CQLValue a3(Uint64(25));
    CQLValue a4(Uint64(30));
    CQLValue a5(Uint64(150));

    PEGASUS_TEST_ASSERT(a1 != a2);
    PEGASUS_TEST_ASSERT(a5 == a5);
    PEGASUS_TEST_ASSERT(a1 < a2);
    PEGASUS_TEST_ASSERT(a2 >= a1);
    PEGASUS_TEST_ASSERT(a1 <= a2);
    PEGASUS_TEST_ASSERT(a2 > a1);

    // Sint64 tests

    CQLValue b1(Sint64(10));
    CQLValue b2(Sint64(15));
    CQLValue b3(Sint64(25));
    CQLValue b4(Sint64(30));
    CQLValue b5(Sint64(150));

    PEGASUS_TEST_ASSERT(b1 != b2);
    PEGASUS_TEST_ASSERT(b5 == b5);
    PEGASUS_TEST_ASSERT(b1 < b2);
    PEGASUS_TEST_ASSERT(b2 >= b1);
    PEGASUS_TEST_ASSERT(b1 <= b2);
    PEGASUS_TEST_ASSERT(b2 > b1);

    // Real64 tests

    CQLValue c1(Real64(10.00));
    CQLValue c2(Real64(15.00));
    CQLValue c3(Real64(25.00));
    CQLValue c4(Real64(30.00));
    CQLValue c5(Real64(150.00));

    PEGASUS_TEST_ASSERT(c1 != c2);
    PEGASUS_TEST_ASSERT(c5 == c5);
    PEGASUS_TEST_ASSERT(c1 < c2);
    PEGASUS_TEST_ASSERT(c2 >= c1);
    PEGASUS_TEST_ASSERT(c1 <= c2);
    PEGASUS_TEST_ASSERT(c2 > c1);

    // Misc
    PEGASUS_TEST_ASSERT(a1 == b1);
    PEGASUS_TEST_ASSERT(a1 == c1);
    PEGASUS_TEST_ASSERT(b1 == a1);
    PEGASUS_TEST_ASSERT(b1 == c1);
    PEGASUS_TEST_ASSERT(c1 == a1);
    PEGASUS_TEST_ASSERT(c1 == b1);

    PEGASUS_TEST_ASSERT(a2 != b1);
    PEGASUS_TEST_ASSERT(a2 != c1);
    PEGASUS_TEST_ASSERT(b2 != a1);
    PEGASUS_TEST_ASSERT(b2 != c1);
    PEGASUS_TEST_ASSERT(c2 != a1);
    PEGASUS_TEST_ASSERT(c2 != b1);

    PEGASUS_TEST_ASSERT(a2 >= b1);
    PEGASUS_TEST_ASSERT(a2 >= c1);
    PEGASUS_TEST_ASSERT(b2 >= a1);
    PEGASUS_TEST_ASSERT(b2 >= c1);
    PEGASUS_TEST_ASSERT(c2 >= a1);
    PEGASUS_TEST_ASSERT(c2 >= b1);

    PEGASUS_TEST_ASSERT(a2 <= b3);
    PEGASUS_TEST_ASSERT(a2 <= c3);
    PEGASUS_TEST_ASSERT(b2 <= a3);
    PEGASUS_TEST_ASSERT(b2 <= c3);
    PEGASUS_TEST_ASSERT(c2 <= a3);
    PEGASUS_TEST_ASSERT(c2 <= b3);

    PEGASUS_TEST_ASSERT(a2 > b1);
    PEGASUS_TEST_ASSERT(a2 > c1);
    PEGASUS_TEST_ASSERT(b2 > a1);
    PEGASUS_TEST_ASSERT(b2 > c1);
    PEGASUS_TEST_ASSERT(c2 > a1);
    PEGASUS_TEST_ASSERT(c2 > b1);

    PEGASUS_TEST_ASSERT(a2 < b3);
    PEGASUS_TEST_ASSERT(a2 < c3);
    PEGASUS_TEST_ASSERT(b2 < a3);
    PEGASUS_TEST_ASSERT(b2 < c3);
    PEGASUS_TEST_ASSERT(c2 < a3);
    PEGASUS_TEST_ASSERT(c2 < b3);

    //Overflow testing
    CQLValue real1(Real64(0.00000001));
    CQLValue sint1(Sint64(-1));
    CQLValue uint1(Sint64(1));
    CQLValue uint2(Uint64(0));

    PEGASUS_TEST_ASSERT(uint1 > sint1);
    PEGASUS_TEST_ASSERT(real1 > sint1);
    PEGASUS_TEST_ASSERT(uint2 > sint1);
    PEGASUS_TEST_ASSERT(real1 > uint2);

    CQLValue real2(Real64(25.00000000000001));
    CQLValue real3(Real64(24.99999999999999));
    CQLValue sint2(Sint64(25));
    CQLValue uint3(Uint64(25));

    PEGASUS_TEST_ASSERT(real2 > real3);
    PEGASUS_TEST_ASSERT(real2 > sint2);
    PEGASUS_TEST_ASSERT(real2 > uint3);
    PEGASUS_TEST_ASSERT(real3 < sint2);
    PEGASUS_TEST_ASSERT(real3 < uint3);

    // String tests

    CQLValue d1(String("HELLO"));
    CQLValue d2(String("HEL"));
    CQLValue d3(String("LO"));
    CQLValue d4(String("AHELLO"));
    CQLValue d5(String("ZHELLO"));

    PEGASUS_TEST_ASSERT(d1 == d2 + d3);
    PEGASUS_TEST_ASSERT(d1 != d2 + d4);

    PEGASUS_TEST_ASSERT(d1 <= d5);
    PEGASUS_TEST_ASSERT(d1 <  d5);

    PEGASUS_TEST_ASSERT(d1 >= d4);
    PEGASUS_TEST_ASSERT(d1 >  d4);

    String str1("0x10");
    String str2("10");
    String str3("10B");
    String str4("10.10");


    CQLValue e1( str1, CQLValue::Hex);
    CQLValue e2( str2, CQLValue::Decimal);
    CQLValue e3( str3, CQLValue::Binary);
    CQLValue e4( str4, CQLValue::Real);

    CQLValue e5(Uint64(16));
    CQLValue e6(Uint64(10));
    CQLValue e7(Uint64(2));
    CQLValue e8(Real64(10.10));

    PEGASUS_TEST_ASSERT(e1 == e5);
    PEGASUS_TEST_ASSERT(e2 == e6);
    PEGASUS_TEST_ASSERT(e3 == e7);
    PEGASUS_TEST_ASSERT(e4 == e8);

    Array<Uint64> array1;

    array1.append(1);
    array1.append(2);
    array1.append(3);
    array1.append(4);
    array1.append(5);
    array1.append(6);
    array1.append(7);
    array1.append(8);
    array1.append(9);
    array1.append(10);

    Array<Sint64> array2;

    array2.append(1);
    array2.append(2);
    array2.append(3);
    array2.append(4);
    array2.append(5);
    array2.append(6);
    array2.append(7);
    array2.append(8);
    array2.append(9);
    array2.append(10);
    array2.append(3);

    Array<Real64> array3;

    array3.append(1.00);
    array3.append(2.00);
    array3.append(3.00);
    array3.append(9.00);
    array3.append(10.00);
    array3.append(3.00);
    array3.append(4.00);
    array3.append(5.00);
    array3.append(6.00);
    array3.append(7.00);
    array3.append(8.00);

    Array<Uint64> array4;

    array4.append(1);
    array4.append(23);
    array4.append(3);
    array4.append(4);
    array4.append(5);
    array4.append(6);
    array4.append(7);
    array4.append(88);
    array4.append(9);
    array4.append(10);

    Array<Sint64> array5;

    array5.append(-1);
    array5.append(2);
    array5.append(3);
    array5.append(4);
    array5.append(5);
    array5.append(-6);
    array5.append(7);
    array5.append(8);
    array5.append(9);
    array5.append(10);
    array5.append(-3);

    Array<Real64> array6;

    array6.append(1.23);
    array6.append(2.00);
    array6.append(3.00);
    array6.append(9.00);
    array6.append(10.00);
    array6.append(3.00);
    array6.append(4.14);
    array6.append(5.00);
    array6.append(6.00);
    array6.append(7.00);
    array6.append(8.00);

    CIMValue cv1(array1);
    CIMValue cv2(array2);
    CIMValue cv3(array3);
    CIMValue cv4(array4);
    CIMValue cv5(array5);
    CIMValue cv6(array6);

    CQLValue vr1(cv1);
    CQLValue vr2(cv1);
    CQLValue vr3(cv2);
    CQLValue vr4(cv3);
    CQLValue vr5(cv4);
    CQLValue vr6(cv5);
    CQLValue vr7(cv6);

    PEGASUS_TEST_ASSERT(vr1 == vr2);
    PEGASUS_TEST_ASSERT(vr1 == vr3);
    PEGASUS_TEST_ASSERT(vr1 == vr4);
    PEGASUS_TEST_ASSERT(vr4 == vr3);

    PEGASUS_TEST_ASSERT(vr1 != vr5);
    PEGASUS_TEST_ASSERT(vr3 != vr6);
    PEGASUS_TEST_ASSERT(vr4 != vr7);

    const CIMName _cimName(String("CIM_OperatingSystem"));

    CIMInstance _i1(_cimName);
    CIMProperty _p1(CIMName("Description"),CIMValue(String("Dave Rules")));
    CIMProperty _p2(CIMName("EnabledState"),CIMValue(Uint16(2)));
    CIMProperty _p3(CIMName("CurrentTimeZone"),CIMValue(Sint16(-600)));
    CIMProperty _p4(CIMName("TimeOfLastStateChange"),
                    CIMValue(CIMDateTime(String("20040811105625.000000-360"))));

    _i1.addProperty(_p1);
    _i1.addProperty(_p2);
    _i1.addProperty(_p3);
    _i1.addProperty(_p4);

    CIMInstance _i2(_cimName);
    CIMProperty _p5(CIMName("Description"),
                    CIMValue(String("Dave Rules Everything")));
    CIMProperty _p6(CIMName("EnabledState"),CIMValue(Uint16(2)));
    CIMProperty _p7(CIMName("CurrentTimeZone"),CIMValue(Sint16(-600)));
    CIMProperty _p8(CIMName("TimeOfLastStateChange"),
                    CIMValue(CIMDateTime(String("20040811105625.000000-360"))));

    _i2.addProperty(_p5);
    _i2.addProperty(_p6);
    _i2.addProperty(_p7);
    _i2.addProperty(_p8);

    CQLValue cql1(_i1);
    CQLValue cql2(_i1);
    CQLValue cql3(_i2);
    CQLValue cql4(_i2);

    //PEGASUS_TEST_ASSERT(cql1 == cql1);

    return;
}
示例#15
0
文件: main.cpp 项目: ln43/TPString
int main(){
  String str;
  String str2("Salut");
  String str4("Beaucoup");
  String str3(str2);

  printf("Length : %zu \n",str2.length());
  printf("Max_Size : %zu \n",str2.max_size());

  str2.resize((size_t)7);
  printf("Size: %zu \n",str2.size());
  
  str2.clear();
  printf("Size: %zu \n",str2.size());
  
  const char* essai=str3.c_str();
  printf(essai);
  
  String str6=str4 +" trop" ;

  str2='c';


  str2.resize((size_t)3,'c');
  //~ String str6(str);

  str2.resize((size_t)102,'c');

  str2='c';
  String operatoregal;
  operatoregal=str4;
  printf("Size: %zu \n",operatoregal.size());

  printf("%zu \n",str2.capacity()) ;
  printf("%d \n",str2.empty()) ;
  printf("%d \n",str.empty()) ;
  String str5("Hello !") ;
  printf("Size : %zu\n",str5.length()) ;
  printf("Capacity : %zu\n",str5.capacity()) ;
  str5.reserve((size_t)10) ;
  printf("Size : %zu\n",str5.length()) ;
  printf("Capacity : %zu\n",str5.capacity()) ;
  str5.reserve((size_t)9) ;
  printf("Size : %zu\n",str5.length()) ;
  printf("Capacity : %zu\n",str5.capacity()) ;
  str5.reserve((size_t)5) ;
  printf("Size : %zu\n",str5.length()) ;
  printf("Capacity : %zu\n",str5.capacity()) ;
  //~ str5.reserve((size_t)200) ;
  //~ printf("Size : %zu\n",str5.length()) ;
  //~ printf("Capacity : %zu\n",str5.capacity()) ;
  //~ 
  String str360;
  str360=str2+'d';
  printf("Size : %zu\n",str360.length()) ;
  String elea1("Bla");
  printf("Size : %zu\n",elea1.length()) ;
  printf("Capacity : %zu\n",elea1.capacity()) ;

  String elea2(" bla");
  String elea3 = elea1 + elea2 ;
  printf("Size : %zu\n",elea3.length()) ;
  printf("Capacity : %zu\n",elea3.capacity()) ;
  return 0 ;
}
示例#16
0
文件: test.cpp 项目: DropD/FooCL
int main (int argc, char const* argv[])
{
    fcl::Environment env;

    fcl::KernelFunc kernel(env, "test_kernel");

    kernel
        << "__kernel void test_kernel("         << "\n"
        << "    void"                           << "\n"
        << ")"                                  << "\n"
        << "{"                                  << "\n"
        << "    int tid = get_global_id(0);"    << "\n"
        << "}"                                  << "\n";

    kernel.build();

    std::cout << "kernel: " << std::endl << kernel <<  std::endl;

    {
        fcl::ExpKernel kernel2(env, "exp_kernel");
        kernel2
            [ "__kernel void exp_kernel(" ]
            [ ")" ]
            [ "{" ]
            [ "    int bla = 5;"]
            [ "}" ];
        std::cout << "kernel2: " << std::endl << kernel2 << std::endl;
    }

    std::complex<double> c;
    std::vector<double> v;
    unsigned result;
    fcl::mini_xml blaxml;

    fcl::roman<std::string::const_iterator> roman_parser;

    std::string str("1, 2, 3, 4, 5");
    std::string str2("(1.5, 6.4)");
    std::string str3("MCMLXXXVIII");
    std::string str4("<mini_xml><head>bla</head></mini_xml>");

    if(fcl::parse_numbers(str.begin(), str.end()) &&
       fcl::parse_complex(str2.begin(), str2.end(), c) &&
       fcl::parse_list(str.begin(), str.end(), v) &&
       fcl::parse_roman(str3.begin(), str3.end(), result) &&
       fcl::parse_mini_xml(str4.begin(), str4.end(), blaxml))
    {
        std::cout << "Parsing succeeded" << std::endl;
        std::cout << str << " Parses OK" << std::endl;
        std::cout << str2 << " Parses OK --> c = " << c << std::endl;
        std::cout << "List parser OK" << std::endl;
        std::cout << str3 << " Parses OK --> result = " << result << std::endl;
        std::cout << str4 << " Parses OK" << std::endl;
    }
    else
    {
        std::cout << "Parsing failed" << std::endl;
    }
    
    return 0;
}
示例#17
0
void CHttpHdrTest::TestHeaderCollIterL()
	{
	RStringF field1Str = iStrP.OpenFStringL(_L8("hcfield1"));
	CleanupClosePushL(field1Str);
	RStringF value1Str = iStrP.OpenFStringL(_L8("hcvalue1"));
	CleanupClosePushL(value1Str);
	RStringF field2Str = iStrP.OpenFStringL(_L8("hcfield2"));
	CleanupClosePushL(field2Str);
	RStringF value2Str = iStrP.OpenFStringL(_L8("hcvalue2"));
	CleanupClosePushL(value2Str);
	RStringF field3Str = iStrP.OpenFStringL(_L8("hcfield3"));
	CleanupClosePushL(field3Str);
	RStringF value3Str = iStrP.OpenFStringL(_L8("hcvalue3"));
	CleanupClosePushL(value3Str);
	RStringF field4Str = iStrP.OpenFStringL(_L8("hcfield4"));
	CleanupClosePushL(field4Str);
	RStringF value4Str = iStrP.OpenFStringL(_L8("hcvalue4"));
	CleanupClosePushL(value4Str);
	//

	CTextModeHeaderCodec* headerCodec = CTextModeHeaderCodec::NewL(iStrP);
	CleanupStack::PushL(headerCodec);
	CHeaders* headers = CHeaders::NewL(*headerCodec);
	CleanupStack::PushL(headers);
	RHTTPHeaders hdr = headers->Handle();

	THTTPHdrVal str1(value1Str);
	hdr.SetFieldL(field1Str, str1);
	THTTPHdrVal str2(value2Str);
	hdr.SetFieldL(field2Str, str2);
	THTTPHdrVal str3(value3Str);
	hdr.SetFieldL(field3Str, str3);
	THTTPHdrVal str4(value4Str);
	hdr.SetFieldL(field4Str, str4);

	THTTPHdrFieldIter it = hdr.Fields();
	TInt count = 0;
	while (it.AtEnd() == EFalse)
		{
		RStringTokenF nextTk = it();
		RStringF nextStr = iStrP.StringF(nextTk);
		THTTPHdrVal hVal;
		TestL(hdr.GetField(nextStr,0,hVal)==KErrNone);
		switch (count)
			{
			case 0:
				TestL(nextStr.Index(RHTTPSession::GetTable()) == field1Str.Index(RHTTPSession::GetTable()));
				break;
			case 1:
				TestL(nextStr.Index(RHTTPSession::GetTable()) == field2Str.Index(RHTTPSession::GetTable()));
				break;
			case 2:
				TestL(nextStr.Index(RHTTPSession::GetTable()) == field3Str.Index(RHTTPSession::GetTable()));
				break;
			case 3:
					TestL(nextStr.Index(RHTTPSession::GetTable()) == field4Str.Index(RHTTPSession::GetTable()));
				break;
			}
		++it;
		++count;
		}

	// Close strings used in this test
	CleanupStack::PopAndDestroy(10);
	}
示例#18
0
void Debuger::DrawEntitiesStats(int eco){
    sf::View currentView    = _window->getView();
    sf::Vector2f centerView = currentView.getCenter();
    sf::Vector2f sizeView   = currentView.getSize();
    _text.setPosition(centerView.x-sizeView.x/2, centerView.y-sizeView.y/2+_displace);
    std::stringstream buffer;

    Scene* s = Scene::getScene();
    Ecosystem *e1 = s->getEcosystem(eco);

    buffer << "Ecosystem " << eco << " (" << e1->getInterval().x << " - " << e1->getInterval().y <<") Num Mobs: " << e1->getMobPopulationAndTreshold().x <<  "/" << e1->getMobPopulationAndTreshold().y <<  "/" << e1->getMobPopulationAndTreshold().z << "Num Trees: " << e1->getTreePopulationAndTreshold().x <<  "/" << e1->getTreePopulationAndTreshold().y <<  "/" << e1->getTreePopulationAndTreshold().z;
    std::string string(buffer.str());
    sf::String str(string);
    _text.setString(str);
    _window->draw(_text);
    _displace = _displace + DISPLACEMENT;

    sf::Vector2f position = _window->mapPixelToCoords(sf::Mouse::getPosition(*_window));
    float zoom = s->getZoom();
    sf::Vector2f position_center = sf::Vector2f(s->getPlayer()->GetPosition().x+Player::PLAYER_WIDTH/2,s->getPlayer()->GetPosition().y+Player::PLAYER_WIDTH/2);
    sf::Vector2f position_zoomed = (position-position_center)/zoom +position_center;
    position = position_zoomed;
    std::vector<Mob*> mobs;
    s->getMobsOnArea(mobs,sf::Vector2i(position),100,eco);
    for(int i =0; i<mobs.size();i++){
        mobs[i]->_focusDebug = true;
    }
    if(mobs.size()>0) {
        std::stringstream buffer2;
        buffer2 << "Mob Position colision: " << mobs[0]->_positionCol.x << " " << mobs[0]->_positionCol.y << " Size colision: " << mobs[0]->_sizeCol.x << " " << mobs[0]->_sizeCol.y << " Radius: " << mobs[0]->getGenetics()->_distanceMaxReproduce << "/" << mobs[0]->getGenetics()->_distanceMaxMove;
        std::string string(buffer2.str());
        sf::String str(string);
        _text.setString(str);
        _text.setPosition(centerView.x-sizeView.x/2, centerView.y-sizeView.y/2+_displace);
        _window->draw(_text);
        _displace = _displace + DISPLACEMENT;

        std::stringstream buffer3;
        buffer3 << "Race: " << mobs[0]->getGenetics()->_race << " Life: " << mobs[0]->_life << "/" << mobs[0]->getGenetics()->_health << " Hunger: " << mobs[0]->_hunger << "/" << mobs[0]->getGenetics()->_foodNeeds << " Age: " << mobs[0]->_age << "/" << mobs[0]->getGenetics()->_age << " Target: " << (mobs[0]->_target !=nullptr);
        std::string string3(buffer3.str());
        sf::String str3(string3);
        _text.setString(str3);
        _text.setPosition(centerView.x-sizeView.x/2, centerView.y-sizeView.y/2+_displace);
        _window->draw(_text);
        _displace = _displace + DISPLACEMENT;

        std::stringstream buffer4;
        buffer4 << "Food: ";
        for(int i =0; i< mobs[0]->getGenetics()->_food.size();i++){
            buffer4 << mobs[0]->getGenetics()->_food[i] << " ";
        }
        buffer4 << "\n Enemys: ";
        for(int i =0; i< mobs[0]->getGenetics()->_enemys.size();i++){
            buffer4 << mobs[0]->getGenetics()->_enemys[i] << " ";
        }
        buffer4 << "\n Friends: ";
        for(int i =0; i< mobs[0]->getGenetics()->_friends.size();i++){
            buffer4 << mobs[0]->getGenetics()->_friends[i] << " ";
        }
        buffer4 << "\n Neutral: ";
        for(int i =0; i< mobs[0]->getGenetics()->_neutral.size();i++){
            buffer4 << mobs[0]->getGenetics()->_neutral[i] << " ";
        }
        std::string string4(buffer4.str());
        sf::String str4(string4);
        _text.setString(str4);
        _text.setPosition(centerView.x-sizeView.x/2, centerView.y-sizeView.y/2+_displace);
        _window->draw(_text);
        _displace = _displace + DISPLACEMENT*4;
    } else {

        std::vector<Tree*> trees;
        s->getTreesOnArea(trees,sf::Vector2i(position),100,eco);
        if(trees.size() >0){
            int pos_l = 0;
            int pos_r = 0;
            if(trees[0]->_left_n != nullptr) pos_l = trees[0]->_left_n->_position.x;
            if(trees[0]->_right_n != nullptr) pos_r = trees[0]->_right_n->_position.x;
            std::stringstream buffer2;
            buffer2 << "Tree Position: " << trees[0]->_position.x << " " << trees[0]->_position.y << " padding: " << trees[0]->_min_x << ", " << trees[0]->_max_x <<" Health: " << trees[0]->_life <<" Reproduce countdown: " << trees[0]->_timeToReproduce << "\n";
            buffer2 << "Damage time: " << trees[0]->_debug_last_damage_time << " Damage distance: " << trees[0]->_debug_last_damage_distance << " Damage temp: " << trees[0]->_debug_last_damage_temp << " Damage humid " << trees[0]->_debug_last_damage_hum << "\n";
            buffer2 << "Tree Fathers: " << pos_l << " " << pos_r << "\n";
            TreeGenetics *gens = trees[0]->getGenetics();
            buffer2 << "Tree corb: " << gens->_corb << " Tree amplitude: " << gens->_amplitude << " Tree height: " << gens->_height << "\n";
            buffer2 << "Branch amount: " << gens->_branchAmount << " Curve branch: " << gens->_curveBranch << " Branch size: " << gens->_sizeBranch << "\n";
            buffer2 << "Type leave: " << gens->_typeLeave << " Amount leave: " << gens->_amountLeave << " Density leave: " << gens->_densityLeave << "\n";
            buffer2 << "Life: " << gens->_health << " Cold res " << gens->_cold << " Hot res " << gens->_hot << " Humidity res " << gens->_humidity << " Gen strenght " << gens->_strenghtGen << " Reproduce freq " << gens->_reproduceFactor;
            std::string string(buffer2.str());
            sf::String str(string);
            _text.setString(str);
            _text.setPosition(centerView.x-sizeView.x/2, centerView.y-sizeView.y/2+_displace);
            _window->draw(_text);
            _displace = _displace + DISPLACEMENT*7;
        }


    }
}
示例#19
0
int
make_labl(int fd)
{
	printf("making LABL...\n");

	memset((char *)buffer, 0, sizeof(buffer));

	/*
	 * try to look like a Trident T-300
	 */
	cyls = 815;
	heads = 19;
	blocks_per_track = 17;

	buffer[0] = str4("LABL");	/* label LABL */
	buffer[1] = 1;			/* version = 1 */
	buffer[2] = cyls;		/* # cyls */
	buffer[3] = heads;		/* # heads */
	buffer[4] = blocks_per_track;	/* # blocks */
	buffer[5] = heads*blocks_per_track; /* heads*blocks */
	buffer[6] = str4("MCR1");	/* name of micr part */
	buffer[7] = str4("LOD1");	/* name of load part */

	if (use_lod2) {
		buffer[7] = str4("LOD2");	/* name of load part */
	}

	{
		int i, count;
		int p = 0200;
		
		count = 0;
		for (i = 0; parts[i].name; i++)
			count++;

		printf("%d partitions\n", i);

		buffer[p++] = count; /* # of partitions */
		buffer[p++] = 7; /* words / partition */

		for (i = 0; i < count; i++) {
			unsigned long n;
			char *pn = parts[i].name;

			printf("%s, start %o, size %o\n",
			       pn, parts[i].start, parts[i].size);

			n = str4(pn);

			buffer[p++] = n;
			buffer[p++] = parts[i].start;
			buffer[p++] = parts[i].size;
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");
			buffer[p++] = str4("    ");

		}
	}

//#define LABEL_PAD_CHAR '\200'
#define LABEL_PAD_CHAR '\0'
	/* pack brand text - offset 010, 32 bytes */
	memset((char *)&buffer[010], LABEL_PAD_CHAR, 32);

	/* pack text label - offset 020, 32 bytes */
	memset((char *)&buffer[020], ' ', 32);
	memcpy((char *)&buffer[020], "CADR diskmaker image", 21);

	/* comment - offset 030, 32 bytes */
	memset((char *)&buffer[030], LABEL_PAD_CHAR, 32);

	strcpy((char *)&buffer[030], mcr_filename);
	printf("comment: '%s'\n", mcr_filename);

#ifdef NEED_SWAP
	swapbytes(buffer);
#endif

	write(fd, buffer, 256*4);
}
示例#20
0
文件: t_sexpr.cpp 项目: iley/intelib
int main()
{
    try {
        TestSection("StdTerms");
        TestSubsection("TermGarbage");
        {
            MyTestTerm *term1 = new MyTestTerm(10);
            MyTestTerm2 *term2 = new MyTestTerm2(20);
            SReference ref1(term1);
            SReference ref2(term2);
            SReference ref3(new MyTestTerm(30));
            SReference ref4(new MyTestTerm2(40));
            TEST("constructed", constructed, 4);
            TEST("noone-destructed", destructed, 0);
            ref4 = new MyTestTerm(300);
            TEST("assign_ptr", destructed, 1);
            ref4 = ref1;
            TEST("assign_ref", destructed, 2);
            ref3 = 0;
            TEST("assign_null", destructed, 3);
        }
        TEST("correctness", constructed, destructed);
        {
            constructed = destructed = 0;
            SReference ref1(new MyTestTerm(200));
            SReference ref2(new MyTestTerm(300));
            TESTB("before_assigning_refs",constructed == 2 && destructed == 0);
            ref1 = ref2;
            TEST("after_assigning_refs", destructed, 1);
        }
        TestSubsection("TermType");
        {
            SReference ref5(new MyTestTerm(50));
            TESTB("type-of", ref5->TermType() == MyTestTerm::TypeId);
            TESTB("not-type-of", ref5->TermType() != MyTestTerm2::TypeId);
            TESTB("subtype", ref5->TermType().IsSubtypeOf(SExpression::TypeId));
            TESTB("not-subtype",
                 !(ref5->TermType().IsSubtypeOf(MyTestTerm2::TypeId)));
            SReference ref6(new MyTestTerm22(60));
            TESTB("subtype2_", ref6->TermType() == MyTestTerm22::TypeId);
            TESTB("22subE",
                MyTestTerm22::TypeId.IsSubtypeOf(SExpression::TypeId));
            TESTB("22sub2",
                MyTestTerm22::TypeId.IsSubtypeOf(MyTestTerm2::TypeId));
            TESTB("2subE",
                MyTestTerm2::TypeId.IsSubtypeOf(SExpression::TypeId));
            TESTB("subtype2",
                ref6->TermType().IsSubtypeOf(SExpression::TypeId));
            TESTB("subtype22",
                ref6->TermType().IsSubtypeOf(MyTestTerm2::TypeId));
            TESTB("subtype22_self",
                 ref6->TermType().IsSubtypeOf(MyTestTerm22::TypeId));
            SReference ref7(new MyTestTerm2(70));
            TESTB("not-subtype22",
                 !(ref7->TermType().IsSubtypeOf(MyTestTerm22::TypeId)));
        }
        TestSubsection("TermCasts");
        {
            SReference ref(new MyTestTerm(50));
            SReference ref2(new MyTestTerm2(70));
            TESTB("cast_to_lterm", ref.DynamicCastGetPtr<SExpression>()
                 == ref.GetPtr());
            TESTB("cast_to_lterm2", ref.DynamicCastGetPtr<SExpression>()
                 == ref.GetPtr());
            TESTB("cast_to_itself", ref.DynamicCastGetPtr<MyTestTerm>() ==
                 ref.GetPtr());
            TESTB("failed_cast", ref.DynamicCastGetPtr<MyTestTerm2>()==0);
        }
        TestSubsection("SExpressionCasts");
        {
            SReference ref(new MyTestTerm(50));
            SReference ref2(new MyTestTerm2(70));
            TESTB("cast_to_lterm", ref.DynamicCastGetPtr<SExpression>()
                 == ref.GetPtr());
            TESTB("cast_to_lterm2", ref.DynamicCastGetPtr<SExpression>()
                 == ref.GetPtr());
            TESTB("cast_to_itself", ref.DynamicCastGetPtr<MyTestTerm>()
                 == ref.GetPtr());
            TESTB("failed_cast", ref.DynamicCastGetPtr<MyTestTerm2>()==0);
        }
        TestSubsection("BasicTerms");
        {
            SReference intref(25);
            TESTC("integer_term", intref->TermType(), SExpressionInt::TypeId);
            TEST("integer_value", intref.GetInt(), 25);
            SReference floatref(25.0);
            TESTC("float_term", floatref->TermType(), SExpressionFloat::TypeId);
            TESTC("float_value", floatref.GetFloat(), (intelib_float_t)25.0);
            SReference strref("A_STRING");
            TESTC("pchar_term", strref->TermType(), SExpressionString::TypeId);
            TESTC("pchar_value", strcmp((const char*)strref.GetString(),
                                        "A_STRING"),
                  0);
            SReference charref('a');
            TESTC("char_term", charref->TermType(), SExpressionChar::TypeId);
            TEST("char_value", charref.GetSingleChar(), 'a');

        }
        TestSubsection("SExpressionString");
        {
            SReference strref1(new SExpressionString("A", "B"));
            TEST("concatenation_1_1", strref1.GetString(), "AB");
            SReference strref2(new SExpressionString("AA", "BB"));
            TEST("concatenation_2_2", strref2.GetString(), "AABB");
            SReference strref3(new SExpressionString("AAA", "BBB"));
            TEST("concatenation_3_3", strref3.GetString(), "AAABBB");
            SReference strref4(new SExpressionString("AAAA", "BBBB"));
            TEST("concatenation_4_4", strref4.GetString(), "AAAABBBB");
            SReference strref5(new SExpressionString("AAAAA", "BBBBB"));
            TEST("concatenation_5_5", strref5.GetString(), "AAAAABBBBB");
            SReference strref6(new SExpressionString("A"));
            TEST("construction1", strref6.GetString(), "A");
            SReference strref7(new SExpressionString("AA"));
            TEST("construction2", strref7.GetString(), "AA");
            SReference strref8(new SExpressionString("AAA"));
            TEST("construction3", strref8.GetString(), "AAA");
            SReference strref9(new SExpressionString("AAAA"));
            TEST("construction4", strref9.GetString(), "AAAA");


        }
        TestSubsection("SString");
        {
            SString str1;
            TESTC("default_is_empty", str1.c_str()[0], '\0');
            SString str2("");
            TESTC("empty_strings", str1, str2);
            TESTC("empty_is_empty", str2.c_str()[0], '\0');
            SString str3("AAA");
            SString str4("BBB");
            SString str5 = str3 + str4;
            TEST("string_addition", str5.c_str(), "AAABBB");
            SString str6("CCC");
            str6 += "DDD";
            TEST("string_increment_by_pchar", str6.c_str(), "CCCDDD");
            SString str7("EEE");
            SString str8("FFF");
            str7 += str8;
            TEST("string_increment_by_string", str7.c_str(), "EEEFFF");

            SString str10("Final countdown");
            SString str11("Final");
            str11 += " countdown";
            TESTB("string_equals_itself", str10 == str10);
            TESTB("string_doesnt_differ_from_itself", !(str10 != str10));
            TESTB("two_equal_strings", str10 == str11);
            TESTB("equal_strings_dont_differ", !(str10 != str11));
            SString str12("Another string");
            TESTB("two_non_equal_strings", str11 != str12);
            TESTB("nonequals_non_equal", !(str11 == str12));
            SString str13;
            SString str14("");
            TESTB("empty_strings_equal", str13 == str14);
            TESTB("empty_strings_dont_differ", !(str13 != str14));
            SReference strref("my_string");
            SString str15(strref);
            TEST("string_from_lreference", str15.c_str(), "my_string");
            {
                int flag = 0;
                try {
                    SReference ref(25);
                    SString str(ref);
                }
                catch(IntelibX_not_a_string lx)
                {
                    flag = 0x56;
                }
                TESTB("string_from_int_fails", flag == 0x56);
            }
        }
        TestSubsection("TextRepresentation");
        {
            SReference intref(100);
            TEST("integer_text_rep", intref->TextRepresentation().c_str(),
                 "100");
            char buf[100];
            intelib_float_t fl;
            fl = 100.1;
            SReference fltref(fl);
            snprintf(buf, sizeof(buf), INTELIB_FLOAT_FORMAT, fl);
            TEST("float_text_rep", fltref->TextRepresentation().c_str(),
                 buf);
            fl = 100.0;
            SReference fltref2(fl);
            snprintf(buf, sizeof(buf), INTELIB_FLOAT_FORMAT, fl);
            TEST("float2_text_rep", fltref2->TextRepresentation().c_str(),
                 buf);
            SReference strref("mystring");
            TEST("string_text_rep", strref->TextRepresentation().c_str(),
                 "\"mystring\"");
            SReference unbound;
            SReference unbound2;
            SReference unblist(unbound, unbound2);
            TEST("unbound_text_representation",
                 unblist->TextRepresentation().c_str(),
                 "(#<UNBOUND> . #<UNBOUND>)");
        }
        TestSubsection("DottedPairs");
        {
            SReference pairref(25, 36);
            TEST("pair_25_36", pairref->TextRepresentation().c_str(),
                 "(25 . 36)");
            SReference dotlistref(25, SReference(36, 49));
            TEST("dotlist_25_36_49", dotlistref->TextRepresentation().c_str(),
                 "(25 36 . 49)");
            SReference empty_list_ref(*PTheEmptyList);
            TEST("empty_list_ref", empty_list_ref->TextRepresentation().c_str(),
                 (*PTheEmptyList)->TextRepresentation().c_str());
            TESTB("empty_list_equal_empty", empty_list_ref.GetPtr() ==
                 PTheEmptyList->GetPtr());
            TESTB("dot_list_notequal_empty", dotlistref.GetPtr() !=
                 PTheEmptyList->GetPtr());

            SReference list25ref(25, *PTheEmptyList);
            TEST("list_1_elem", list25ref->TextRepresentation().c_str(),
                 "(25)");
            SReference list_16_25_ref(16, list25ref);
            TEST("cons_with_list", list_16_25_ref->TextRepresentation().c_str(),
                 "(16 25)");
            SReference list_of_lists_ref(list25ref,
                                         SReference(list25ref, *PTheEmptyList));
            TEST("list_of_lists", list_of_lists_ref->TextRepresentation().c_str(),
                 "((25) (25))");

        }
        TestSubsection("SExpressionLabel");
        {
            SExpressionLabel *lab1 = new SExpressionLabel("lab1");
            SReference labref(lab1);
            TEST("label", labref->TextRepresentation().c_str(),
                 "lab1");
            TESTB("label_equality", labref == SReference(lab1));
            SReference labref2(lab1);
            TESTB("label_equality2", labref== labref2);
            SReference ref3(25);
            TESTB("label_non_eq", labref != ref3);

#if 0 // no support for booleans in sexpression core
            TEST("boolean_true", LTheLispBooleanTrue.TextRepresentation().c_str(),
           #if CLSTYLE_BOOLEANS == 0
                 "#T"
           #else
                 "T"
           #endif
                );
#endif
        }
        TestSubsection("SListConstructor");
        {
            SListConstructor L;
            SReference list_int((L|25));
            TEST("list_of_1_int", list_int->TextRepresentation().c_str(),
                 "(25)");
            SReference list_str((L|"abcd"));
            TEST("list_of_1_str", list_str->TextRepresentation().c_str(),
                 "(\"abcd\")");
            intelib_float_t fl = 1.1;
            SReference list_float((L|fl));
            char buf[128];
            snprintf(buf, sizeof(buf), "(" INTELIB_FLOAT_FORMAT ")", fl);
            TEST("list_of_1_float", list_float->TextRepresentation().c_str(),
                 buf);
        }
        TestSubsection("ListConstructionAlgebra");
        {
            SListConstructor L;
            SReference listref((L|25, 36, 49, "abcd", "efgh"));
            TEST("plain_list", listref->TextRepresentation().c_str(),
                 "(25 36 49 \"abcd\" \"efgh\")");
            SReference listref2((L|(L|25), 36, (L|(L|(L|49)))));
            TEST("list_with_lists", listref2->TextRepresentation().c_str(),
                 "((25) 36 (((49))))");
            SReference listref3((L|(L|(L|(L|(L))))));
            TEST("empty_buried_list", listref3->TextRepresentation().c_str(),
                 (SString("((((")+
                  (*PTheEmptyList)->
                  TextRepresentation().c_str()+
                  SString("))))")).c_str());
            SReference dotpairref((L|25 || 36));
            TEST("dotted_pair", dotpairref->TextRepresentation().c_str(),
                 "(25 . 36)");
            SReference dotlistref((L|9, 16, 25)||36);
            TEST("dotted_list", dotlistref->TextRepresentation().c_str(),
                 "(9 16 25 . 36)");
            SReference dotpairref2((L|25)^36);
            TEST("dotted_pair", dotpairref2->TextRepresentation().c_str(),
                 "((25) . 36)");
            SReference dotlistref2((L|9, 16, 25)^36);
            TEST("dotted_list", dotlistref2->TextRepresentation().c_str(),
                 "((9 16 25) . 36)");
            SReference just_a_cons(SReference("abc")^SReference(225));
            TEST("cons_with_^", just_a_cons->TextRepresentation().c_str(),
                 "(\"abc\" . 225)");
            SReference empty(L);
            empty,25;
            TEST("comma_on_empty_list", empty->TextRepresentation().c_str(),
                 "(25)");
        }
        TestSubsection("IsEql");
        {
            SReference five(5);
            TESTB("is_eql_numbers", five.IsEql(5));            
            TESTB("isnt_eql_numbers", !five.IsEql(3));            
            TESTB("isnt_eql_num_to_string", !five.IsEql("abc"));            
            SReference abc("abc");
            TESTB("is_eql_strings", abc.IsEql("abc"));            
            TESTB("isnt_eql_strings", !abc.IsEql("def"));            
            TESTB("isnt_eql_string_to_num", !abc.IsEql(5));            
        }
        TestSubsection("UnboundByDefault");
        {
            SReference unbound;
            TESTB("sreference_unbound", !unbound.GetPtr());

            GenericSReference<MyTestTerm22, IntelibX_wrong_expression_type> p;
            TESTB("gensref_unbound", !p.GetPtr());
        }

#if 0  // no support for booleans
        TestSubsection("Booleans");
        {
            SReference true_ref(LTheLispBooleanTrue);
            TESTB("boolean_true", true_ref->IsTrue());
            SReference false_ref(LTheLispBooleanFalse);
            TESTB("boolean_false", !(false_ref->IsTrue()));
            SReference some_ref(25);
            TESTB("boolean_some", some_ref->IsTrue());

        }
#endif
        TestSubsection("Epilogue");
        TEST("final-cleanup", destructed, constructed);
        TestScore();
    }
    catch(...) {
        printf("Something strange caught\n");
    }
    return 0;
}