/// Tests the Serialization Functions
/// @return True if all tests were executed, false if not
bool BarlineTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 4, 2005
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Barline barlineOut(12, Barline::repeatEnd, 12);
    barlineOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Barline barlineIn;
        barlineIn.Deserialize(streamIn,
            PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((barlineIn == barlineOut)
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
	PropertyID addStreamTextProperty(PID pPID, const char * pValue, bool pRemoveStopWords = true, PropertyID pPropID = STORE_INVALID_URIID)
	{
		TestStream * lStream = new TestStream((int)(40000)*sizeof(char), NULL, VT_STRING ) ;
		
		string forceContent = " "; forceContent+=pValue; forceContent += " ";
		
		memcpy(lStream->getBuffer(), forceContent.c_str(), forceContent.size()*sizeof(char));
		
		PropertyID lPropID;
		if(pPropID == STORE_INVALID_URIID) lPropID = mPropIDs[mCurrentPropIndex++];
		else lPropID = pPropID;
		Value lV ; 
		lV.set(MVTApp::wrapClientStream(mSession, lStream)) ; 
		lV.property = lPropID ;
		lV.meta = META_PROP_FTINDEX;
		if (pRemoveStopWords)
		{
			// Means that any common english words will be excluded from the index
//			lV.meta = META_PROP_STOPWORDS ;	
		}
		IPIN *lPIN = mSession->getPIN(pPID);;
		TVRC_R(lPIN->modify(&lV, 1), mTest);
		if(lPIN) lPIN->destroy();

		lStream->destroy() ;

		return lPropID;
	}
/// Tests the Serialization Functions
/// @return True if all tests were executed, false if not
bool AlternateEndingTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Dec 4, 2004
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    AlternateEnding alternateEndingOut(1, 2, testNumbers);
    alternateEndingOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        AlternateEnding alternateEndingIn;
        alternateEndingIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((alternateEndingIn == alternateEndingOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);

	return (true);
}
/// Tests Serialization
/// @return True if all tests were executed, false if not
bool FontSettingTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Dec 6, 2004
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    FontSetting fontSettingOut(wxT("Arial"), 12, FontSetting::weightBold, true,
        true, true, wxColor(255,0,0));
    fontSettingOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        FontSetting fontSettingIn;
        fontSettingIn.Deserialize(streamIn,
            PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((fontSettingIn == fontSettingOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}    
	PID createStreamTextPin(const char * inProp1, bool bRemoveStopWords = true )
	{
		// Different code in the kernel for stream based strings
		// BUT strings < 0xFF length are turned back to string format
		// so we need to force it.

		TestStream * ts = new TestStream((int)(40000)*sizeof(char), 
					NULL,
					VT_STRING ) ;
		
		string forceContent = " "; forceContent+=inProp1; forceContent += " ";
		
		// Insert the real words part way through the dummy content
		memcpy(ts->getBuffer()/*+32*/,forceContent.c_str(),forceContent.size()*sizeof(char));

		Value vl ; 
		vl.set(MVTApp::wrapClientStream(mSession, ts)) ; 
		vl.property = mProp ;

		if (bRemoveStopWords)
		{
			// Means that any common english words will be excluded from the index
			// vl.meta = META_PROP_STOPWORDS ; // it's done always now
		}
		IPIN *pin;
		TVRC_R(mSession->createPIN(&vl, 1, &pin, MODE_PERSISTENT|MODE_COPY_VALUES),mTest) ;
		ts->destroy() ;
		return pin->getPID() ;
	}
/// Tests Serialization
/// @return True if all tests were executed, false if not
bool GuitarTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Dec 8, 2004
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Guitar guitarOut(1, wxT("Test"), 2, 3, 4, 5, 6, 7, 8, 9);
    guitarOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Guitar guitarIn;
        guitarIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((guitarIn == guitarOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests the Serialization Functions
/// @return True if all tests were executed, false if not
bool PositionTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 18, 2005
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Position positionOut(12, 4, 2);
    positionOut.SetVibrato();
    positionOut.SetVolumeSwell(Dynamic::off, Dynamic::mp, 1);
    positionOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Position positionIn;
        positionIn.Deserialize(streamIn,
            PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((positionIn == positionOut)
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests Serialization
/// @return True if all tests were executed, false if not
bool KeySignatureTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Dec 10, 2004
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    KeySignature keySignatureOut(KeySignature::minorKey, KeySignature::threeFlats);
    keySignatureOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        KeySignature keySignatureIn;
        keySignatureIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((keySignatureIn == keySignatureOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests the Serialization Fucntions
/// @return True if all tests were executed, false if not
bool DirectionTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 11, 2005
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Direction directionOut(12, Direction::toCoda, Direction::activeDaCapo, 4);
    directionOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Direction directionIn;
        directionIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((directionIn == directionOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests the Serialization Functions
/// @return True if all tests were executed, false if not
bool ScoreTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 6, 2005
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Score scoreOut;
    wxUint32 i = 0;
    for (; i < 3; i++)
    {
        scoreOut.m_guitarArray.Add(new Guitar);
        scoreOut.m_chordDiagramArray.Add(new ChordDiagram);
        scoreOut.m_floatingTextArray.Add(new FloatingText);
        scoreOut.m_guitarInArray.Add(new GuitarIn);
        scoreOut.m_tempoMarkerArray.Add(new TempoMarker);
        scoreOut.m_dynamicArray.Add(new Dynamic);
        scoreOut.m_alternateEndingArray.Add(new AlternateEnding);
        scoreOut.m_systemArray.Add(new System);
    }
    scoreOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Score scoreIn;
        scoreIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((scoreIn == scoreOut)
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests the Serialization Functions
/// @return True if all tests were executed, false if not
bool StaffTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 5, 2005

    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    // Write test data to stream
    Staff staffOut(4, Staff::BASS_CLEF);
    wxUint32 i = 0;
    for (; i < 3; i++)
    {
        staffOut.m_positionArray[0].Add(new Position);
        staffOut.m_positionArray[1].Add(new Position);
    }
    staffOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        Staff staffIn;
        staffIn.Deserialize(streamIn, PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((staffIn == staffOut)
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}
/// Tests the Serialization Fucntions
/// @return True if all tests were executed, false if not
bool ChordDiagramTestSuite::TestCaseSerialize()
{
    //------Last Checked------//
    // - Jan 15, 2005
    bool ok = false;
    
    TestStream testStream;
    PowerTabOutputStream streamOut(testStream.GetOutputStream());
    
    ChordName chordName;
    chordName.SetFormula(ChordName::minor);
    
    // Write test data to stream
    ChordDiagram chordDiagramOut(chordName, 3, 3, 4, 5, 5, 3,
        ChordDiagram::stringMuted);
    chordDiagramOut.Serialize(streamOut);

    // Output must be OK before using input
    if (testStream.CheckOutputState())
    {
        PowerTabInputStream streamIn(testStream.GetInputStream());
    
        // Read test data back from stream
        ChordDiagram chordDiagramIn;
        chordDiagramIn.Deserialize(streamIn,
            PowerTabFileHeader::FILEVERSION_CURRENT);

        // Validate the data
        ok = ((chordDiagramIn == chordDiagramOut) 
            && (streamIn.CheckState()));
    }
    
    TEST(wxT("Serialize"), ok);
    
    return (true);
}