Example #1
0
    void runTest() override
    {
        beginTest ("Call single listener");
        listeners.add (&listener1);
        std::vector<int> expectedCounterValues;
        for (int i = 1; i < 8; ++i)
            expectedCounterValues.push_back (i);

        callHelper (expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);

        beginTest ("Call multiple listeners");
        listeners.add (&listener2);
        expectedCounterValues.clear();
        for (int i = 1; i < 8; ++i)
            expectedCounterValues.push_back (-i);

        callHelper (expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);

        beginTest ("Call listeners excluding");
        expectedCounterValues.clear();
        for (int i = 1; i < 8; ++i)
            expectedCounterValues.push_back (i);

        callExcludingHelper (listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
    }
Example #2
0
    void runTest()
    {
        beginTest ("construction and parsing");
        {
            expectThrowsType (OSCAddress (""), OSCFormatError);
            expectThrowsType (OSCAddress ("noleadingslash"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar "), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar#"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar*"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar,"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar?"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar["), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar]"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar{"), OSCFormatError);
            expectThrowsType (OSCAddress ("/notallowedchar}andsomemorechars"), OSCFormatError);
            expectThrowsType (OSCAddress (String::fromUTF8 ("/nonasciicharacter\xc3\xbc""blabla")), OSCFormatError);
            expectThrowsType (OSCAddress ("/nonprintableasciicharacter\t"), OSCFormatError);

            expectDoesNotThrow (OSCAddress ("/"));
            expectDoesNotThrow (OSCAddress ("/a"));
            expectDoesNotThrow (OSCAddress ("/a/"));
            expectDoesNotThrow (OSCAddress ("/a/bcd/"));
            expectDoesNotThrow (OSCAddress ("/abcd/efgh/ijkLMNOPq/666r/s"));
            expectDoesNotThrow (OSCAddress ("/allowedprintablecharacters!$%&()+-.^_`|~"));
            expectDoesNotThrow (OSCAddress ("/additonalslashes//will///be////ignored"));
        }

        beginTest ("conversion to/from String");
        {
            OSCAddress address ("/this/is/a/very/long/address/");
            expectEquals (address.toString(), String ("/this/is/a/very/long/address"));
        }
    }
Example #3
0
File: test.c Project: owalch/oliver
/**
 * @fn      int main(void)
 * @return  int value, 0 if succeeded, -1 if failed
 *
 * This is the main testing function. This function is responsible to test all
 * possible cases.
 */
int main(void){

    int i;
    int rand_prio;
    int func_idx;                               // function index
    MyThread *th;
    char mes_args[MAX_ARGS][STR_LEN];

    
    /* add threads -----------------------------------------------------------*/
    beginTest("Adding threads");
    
    func_idx = 0;
    for (i=0; i<MAX_ARGS; i++) {                // create auto generated threads

        rand_prio = rand()%10;
        if (rand_prio <= 3)
            rand_prio = HIGH;
        else if (rand_prio >3 && rand_prio <=6)
            rand_prio = MEDIUM;
        else
            rand_prio = LOW;

        /* generate random messages */
        sprintf(&(mes_args[i][0]), "rand_Th_%d prio %d", i, rand_prio);
        if (func_idx == 0) {
            myThreadCreate(th, printMessage, (void *)&(mes_args[i][0]), rand_prio, 4096);
        }
        if (func_idx == 1) {
            myThreadCreate(th, printMessageSleep, (void *)&(mes_args[i][0]), rand_prio, 4096);
        }
        if (func_idx == 2) {
            myThreadCreate(th, threadInThread, (void *)&(mes_args[i][0]), rand_prio, 4096);
        }

        func_idx++;                             // handle function indec counter
        func_idx %= 3;
    }



    printReadyQueueStatus();
    sleep(2);
    beginTest("Start scheduling");
    myThreadStart();



    
    endTest();


    sleep(10);
    return 0;
}
    void runTest() override
    {
        std::deque<AnalyticsDestination::AnalyticsEvent> testEvents;

        for (int i = 0; i < 7; ++i)
            testEvents.push_back ({ String (i), 0, Time::getMillisecondCounter(), {}, "TestUser", {} });

        std::deque<AnalyticsDestination::AnalyticsEvent> loggedEvents, unloggedEvents;

        beginTest ("New events");

        {
            DestinationTestHelpers::BasicDestination destination (loggedEvents, unloggedEvents);

            for (auto& event : testEvents)
                destination.logEvent (event);

            size_t waitTime = 0, numLoggedEvents = 0;

            while (numLoggedEvents < testEvents.size())
            {
                if (waitTime > 4000)
                {
                    expect (waitTime < 4000);
                    break;
                }

                Thread::sleep (40);
                waitTime += 40;

                const ScopedLock lock (destination.eventQueueChanging);
                numLoggedEvents = loggedEvents.size();
            }
        }

        compareEventQueues (loggedEvents, testEvents);
        expect (unloggedEvents.size() == 0);

        loggedEvents.clear();

        beginTest ("Unlogged events");
        {
            DestinationTestHelpers::BasicDestination destination (loggedEvents, unloggedEvents);
            destination.setLoggingEnabled (false);

            for (auto& event : testEvents)
                destination.logEvent (event);
        }

        compareEventQueues (unloggedEvents, testEvents);
        expect (loggedEvents.size() == 0);
    }
Example #5
0
int main(){
	float torques[4];
	horizon.set(0.5, 0, 0, 0.5);
	beginTest("Horizon calculation");
	horizon.update(engine, DELTA_T, torques);
	benchFinish();
}
Example #6
0
    void runTest() override
    {
        beginTest("Get&Set Values");
        ZenTime floatParam("floatTest", "Float Test", -96.0f, 18.0f, -18.0f);

        expectAlmostEqual(floatParam.getDefaultValue(), 0.684210526315f);
        expectAlmostEqual(floatParam.getValue(), 0.684210526315f);
        expectAlmostEqual(floatParam.getValueRaw(), -18.0f);
        floatParam.setValue(0.3f);
        expectAlmostEqual(floatParam.getValueRaw(), -61.8f);
        expectAlmostEqual(floatParam.getValue(), 0.3f);
        floatParam.setValueRaw(-7);
        expectAlmostEqual(floatParam.getValueRaw(), -7.0f);
        expectAlmostEqual(floatParam.getValue(), 0.780701754385f);
        floatParam.setValue(0.0f);
        expectAlmostEqual(floatParam.getValueRaw(), -96.0f);
        expectAlmostEqual(floatParam.getValue(), 0.0f);
        floatParam.setValue(1.0f);
        expectAlmostEqual(floatParam.getValueRaw(), 18.0f);
        expectAlmostEqual(floatParam.getValue(), 1.0f);
        floatParam.setValue(1.5f);
        expectAlmostEqual(floatParam.getValueRaw(), 18.0f);
        expectAlmostEqual(floatParam.getValue(), 1.0f);
        floatParam.setValue(-1.0f);
        expectAlmostEqual(floatParam.getValueRaw(), -96.0f);
        expectAlmostEqual(floatParam.getValue(), 0.0f);
    }
 void runTest()
 {
     beginTest ("EncryptedString");
     
     // test with some known keys
     const String knownPublicKey ("11,7eb9c1c3bc8360d1f263f8ee45d98b01");
     const String knownPrivateKey ("2545b175ce0885e2fb72f1b59bbf8261,7eb9c1c3bc8360d1f263f8ee45d98b01");
     
     expectEquals (EncryptedString::encrypt ("hello world!", knownPublicKey),
                   String ("16.PcHEsm3XRKxv0V8hMeKv5A"));
     expectEquals (EncryptedString::decrypt ("16.PcHEsm3XRKxv0V8hMeKv5A", knownPrivateKey),
                   String ("hello world!"));
     
     expectEquals (EncryptedString::encrypt ("hello world!", knownPublicKey, true),
                   String ("508714ed8963d222c3b5d58bcdb7c07a"));
     expectEquals (EncryptedString::decrypt ("508714ed8963d222c3b5d58bcdb7c07a", knownPrivateKey, true),
                   String ("hello world!"));
     
     // test with some generated keys
     RSAKey publicKey, privateKey;
     RSAKey::createKeyPair (publicKey, privateKey, 128);
     
     String encryptedString (EncryptedString::encrypt ("hello world!", publicKey.toString()));
     String decryptedString (EncryptedString::decrypt (encryptedString, privateKey.toString()));
     
     expectEquals (decryptedString, String ("hello world!"));
 }
Example #8
0
    void runTest() override
    {
        beginTest ("Basics");
        Random r = getRandom();

        int randomInt = r.nextInt();
        int64 randomInt64 = r.nextInt64();
        double randomDouble = r.nextDouble();
        String randomString (createRandomWideCharString (r));

        MemoryOutputStream mo;
        mo.writeInt (randomInt);
        mo.writeIntBigEndian (randomInt);
        mo.writeCompressedInt (randomInt);
        mo.writeString (randomString);
        mo.writeInt64 (randomInt64);
        mo.writeInt64BigEndian (randomInt64);
        mo.writeDouble (randomDouble);
        mo.writeDoubleBigEndian (randomDouble);

        MemoryInputStream mi (mo.getData(), mo.getDataSize(), false);
        expect (mi.readInt() == randomInt);
        expect (mi.readIntBigEndian() == randomInt);
        expect (mi.readCompressedInt() == randomInt);
        expectEquals (mi.readString(), randomString);
        expect (mi.readInt64() == randomInt64);
        expect (mi.readInt64BigEndian() == randomInt64);
        expect (mi.readDouble() == randomDouble);
        expect (mi.readDoubleBigEndian() == randomDouble);
    }
Example #9
0
    void runTestForAllTypes (const char* unitTestName)
    {
        beginTest (unitTestName);

        TheTest::template run<float> (*this);
        TheTest::template run<double> (*this);
    }
void MonitorTests::multiThreadedCallBackTest()
{
    beginTest("Concurrent CallBack Test");
    
    Monitor monitor;
    monitor.startMonitoring();
    
    
    OwnedArray<SocketListener> listeners;
    
    for (int i = 0; i < 50 ; i++) {
        SocketListener* listener = new SocketListener();
        listener->initializeSockets((40780 + (5*i)), &monitor, String("quassel") + String(i*20));
        listeners.add(listener);
    }
    
    for (int i = 0; i < 50 ; i++) {
        pool->addJob(listeners[i], false);
    }
    
    while(pool->getNumJobs() > 0 )
    {
        Thread::sleep(20);
    }
    
    monitor.stop();
    for (int i = 0; i < 50 ; i++) {
        
        expectEquals(listeners[i]->was_informed , true);
        
    }
    
}
/*==============================================================================
//  DecibelParameter.cpp
//  Part of the Zentropia JUCE Collection
//  @author Casey Bailey (<a href="SonicZentropy@gmail.com">email</a>)
//  @version 0.1
//  @date 2015/09/08
//  Copyright (C) 2015 by Casey Bailey
//  Provided under the [GNU license]
//
//  Details: Decibel Parameter Class - Handles Log/linear scaling
//
//  Zentropia is hosted on Github at [https://github.com/SonicZentropy]
===============================================================================*/

#include "ZenDecibelParameter.h"
#include "utilities/ZenUtils.hpp"
#include "utilities/ZenDecibelConversions.hpp"

ZenDecibelParameter::ZenDecibelParameter(ZenAudioProcessorValueTreeState& owner, 
	String paramID, String paramName,
	float minValue, float maxValue,  
	float inDefaultValue /*= 0.0f*/, bool shouldBeSmoothed /*= false*/, 
	float smoothingTime /*= 50.0f*/) 
	: 
	ZenParameter(owner, ZenParamType::ZENDECIBEL, paramID, paramName, 
		inDefaultValue, "dB", shouldBeSmoothed, smoothingTime),
	unityDecibels(0.0f), midValue(0.0f)
{
	range = NormalisableRange<float>(minValue, maxValue);
	float normalizedValue = DecibelConversions::mapDecibelsToProperNormalizedValue
		(inDefaultValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParam constructor of: " << paramID << " setting value to : " << normalizedValue);
	defaultValue = normalizedValue;
	ZenDecibelParameter::setValue(normalizedValue);
	currentSmoothedValue = normalizedValue;
	targetValue = normalizedValue;

	//setValueInGainFromNormalised(value.load());
}


ZenDecibelParameter::~ZenDecibelParameter()
{

}

//Set from normalized invalue
void ZenDecibelParameter::setValue(float inNormValue)
{
	//float newValue = DecibelConversions::mapProperNormalizedValueToDecibels(getClamped(inNormValue, 0.0f, 1.0f), range.start, range.end);	
	//DBG("In ZenDecibelParameter::setValue(inValue) of " << this->paramID  << " and storing: " << inNormValue);
	//jassert(inNormValue >= 0 && inNormValue <= 1);
	
	if(inNormValue > 1 || inNormValue < 0)
		DBG("In ZenDecibelParameter::setValue(inNormValue) and input value is not normalized properly");

	if (inNormValue != value.load() || listenersNeedCalling)
	{
		value.store(inNormValue);
	
		
		listeners.call(&ZenAudioProcessorValueTreeState::Listener::parameterChanged, paramID, value.load());
		listenersNeedCalling = false;

		needsUpdate.set(1);
		UIUpdate.store(true);
		
		if (shouldBeSmoothed) setTargetValue(inNormValue);
		setValueInGainFromNormalised(inNormValue);
	}
}


void ZenDecibelParameter::setValueRaw(float inDBValue)
{
	setValueFromDecibels(inDBValue);
}

void ZenDecibelParameter::setValueFromDecibels(float inDBValue)
{
	//value.store(getClamped(inDBValue, range.start, range.end));
	float newNormalizedValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		inDBValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParameter::setValueFromDecibels(inDBValue) of " << this->paramID << " with inDBValue: " << inDBValue << " and storing: " << newNormalizedValue);
	value.store(newNormalizedValue);
	if (shouldBeSmoothed) setTargetValue(newNormalizedValue);

	listeners.call(&ZenAudioProcessorValueTreeState::Listener::parameterChanged, paramID, value.load());
	listenersNeedCalling = false;
	
	setValueInGainFromNormalised(newNormalizedValue);
	needsUpdate.set(1);
	UIUpdate.store(true);
}

void ZenDecibelParameter::setValueFromGain(float inGainValue)
{
	float newValue = getClamped(Decibels::gainToDecibels(inGainValue), range.start, range.end);
	float newNormValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		newValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParameter::setValueFromGain(inValue) of " << this->paramID << " with inValue: " << inGainValue << " and storing value: " << newNormValue);
	value.store(newNormValue);
	if (shouldBeSmoothed) setTargetValue(newNormValue);

	listeners.call(&ZenAudioProcessorValueTreeState::Listener::parameterChanged, paramID, value.load());
	listenersNeedCalling = false;

	setGainValue(inGainValue);
	needsUpdate.set(1);
	UIUpdate.store(true);
}

void ZenDecibelParameter::setValueFromGainNotifyingHost(float inGainValue)
{
	float dbValue = getClamped(Decibels::gainToDecibels(inGainValue), range.start, range.end);
	float newNormValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		dbValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParameter::setValueFromGainNotifyingHost(inValue) of " << this->paramID << " with invalue: " << inGainValue << " and calling setValueNotifyingHost with value: " << newNormValue);
	
	setValueNotifyingHost(newNormValue);
	setGainValue(inGainValue);

}

//inNormValue expected to be normalized
void ZenDecibelParameter::setValueNotifyingHost(float inNormValue)
{
	float clampedValue = getClamped(inNormValue, 0.0f, 1.0f);
	//clampedValue = DecibelConversions::mapDecibelsToProperNormalizedValue(clampedValue, range.start, range.end, midValue);
	
	//DBG("In ZenDecibelParameter::setValueNotifyingHost(inValue) of " << this->paramID << " with invalue: " << inNormValue << " and setParameterNotifyingHost with: " << clampedValue);
	processor->setParameterNotifyingHost(getParameterIndex(), clampedValue);
	if (shouldBeSmoothed) setTargetValue(clampedValue);

	listeners.call(&ZenAudioProcessorValueTreeState::Listener::parameterChanged, paramID, clampedValue);
	listenersNeedCalling = false;
	setValueInGainFromNormalised(value.load());
	needsUpdate.set(1);

}

void ZenDecibelParameter::setValueFromDecibelsNotifyingHost(float inDBValue)
{
	float normValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		inDBValue, range.start, range.end, midValue);
	setValueNotifyingHost(normValue);
	setValueInGainFromNormalised(value.load());
}

void ZenDecibelParameter::setValueInGainFromNormalised(float inNormValue)
{
	float result = DecibelConversions::mapProperNormalizedValueToRawDecibelGain(inNormValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParameter::getValueInGain() returning: " << result);
	valueInGain.store(result);
	UIUpdate.store(true);
}

void ZenDecibelParameter::setGainValue(float inGainValue)
{
	valueInGain.store(inGainValue);
}

float ZenDecibelParameter::getValue()
{
	// #TODO: get rid of this
	if (shouldBeSmoothed)
	{
		//return DecibelConversions::mapProperNormalizedValueToRawDecibelGain(getNextSmoothedValue(), range.start, range.end, midValue);
		////DBG("In ZenDecibelParameter::getValue() of " << this->paramID << " returning smoothed value: " << getNextSmoothedValue());
		return getNextSmoothedValue();
	}
	//DBG("In ZenDecibelParameter::getValue() of " << this->paramID << " returning: " << value.load());
	//return DecibelConversions::mapDecibelsToProperNormalizedValue(
	//	value.load(), range.start, range.end, midValue);
	return value.load();
}

float ZenDecibelParameter::getValue() const
{
	//DBG("In ZenDecibelParameter::getValue() of " << this->paramID << " returning: " << value.load());
		//value.load(), range.start, range.end, midValue));

	//return DecibelConversions::mapDecibelsToProperNormalizedValue(
	//	value.load(), range.start, range.end, midValue);
	return value.load();
}

float ZenDecibelParameter::getValueRaw() const
{
	return getValueInDecibels();
}

float ZenDecibelParameter::getValueInDecibels() const
{
	float result =  DecibelConversions::mapProperNormalizedValueToDecibels(value.load(), range.start, range.end, midValue);
	
	//if (result != -96) DBG("In ZenDecibelParameter::getValueInDecibels() returning: " << result);
	return result;
}

float ZenDecibelParameter::getValueInGain()
{
	float valConvert;
	if (shouldBeSmoothed)
	{
		valConvert = getNextSmoothedValue();
		return DecibelConversions::mapProperNormalizedValueToRawDecibelGain(valConvert, range.start, range.end, midValue);
	}
	else
	{
		return valueInGain.load();
	}	
	//float oldresult = DecibelConversions::mapProperNormalizedValueToRawDecibelGain(value.load(), range.start, range.end, midValue);
	//DBG("*In ZenDecibelParameter::getValueInGain() of " << this->paramID << "with oldresult: " << oldresult << " and new: " << result);			
	//return result;	
}

float ZenDecibelParameter::getValueInGain() const
{
	jassertfalse;
	DBG("****In ZenDecibelParameter::getValueInGain() of " << this->paramID << "with value: " << value.load() << " and returning: " << DecibelConversions::decibelsToDBGain<float>(value.load(), -96.0f));
	DBG("***Testing gain var: " << valueInGain.load());
	float result = DecibelConversions::mapProperNormalizedValueToRawDecibelGain(value.load(), range.start, range.end, midValue);
	return result;
}

// void ZenDecibelParameter::setValueInGainFromDB(float inDBValue)
// {
// 	valueInGain.store(DecibelConversions::)
// }

//Returns NORMALIZED float value for input DECIBEL text value
float ZenDecibelParameter::getValueForText(const String& text) const
{
	DBG("In ZenDecibelParameter::getValueForText(text)of " << this->paramID << " with input text: " << text);
	//return range.convertTo0to1(	text.getFloatValue());
	if (textToValueFunction != nullptr)
		return textToValueFunction(text);
	else //use default function
	{
		//return text.getFloatValue();
		float result = DecibelConversions::mapDecibelsToProperNormalizedValue(
			text.getFloatValue(), range.start, range.end, midValue);
		DBG("In ZenDecibelParameter::getValueForText(text) returning: " << result);
		return result;
	}
}

String ZenDecibelParameter::getText(float inValue, int maxStringLength) const
{	
	////DBG("In ZenDecibelParameter::getText(inValue, maxStringLength) ");
	if (valueToTextFunction != nullptr)
		return valueToTextFunction(DecibelConversions::mapProperNormalizedValueToDecibels(
			inValue, range.start, range.end, midValue));
	else
		return String(value.load(), 2) + " " + String(unitLabel);
}

float ZenDecibelParameter::getRawValueForText(const String& text) const
{
	return text.getFloatValue();
}


String ZenDecibelParameter::getTextFromValue() const
{
	return String(value.load(), 2) + " " + String(unitLabel);
}



void ZenDecibelParameter::setMinDecibels(const float inMinDecibels)
{
	range.start = inMinDecibels;
}

void ZenDecibelParameter::setMaxDecibels(const float inMaxDecibels)
{
	range.end = inMaxDecibels;
}

void ZenDecibelParameter::setDefaultValue(float inDBValue)
{
	defaultValue = DecibelConversions::mapDecibelsToProperNormalizedValue(inDBValue, range.start, range.end, midValue);
}

float ZenDecibelParameter::getDefaultValue() const
{
	//return DecibelConversions::mapDecibelsToProperNormalizedValue(
	//	value.load(), range.start, range.end, defaultValue);
	return defaultValue;
}

void ZenDecibelParameter::valueChanged(Value& inValue)
{
	 ////DBG("In ZenDecibelParameter::valueChanged(value) ");
	setValueTree();
}

void ZenDecibelParameter::setNewState(const ValueTree& v)
{
	state = v;
	updateFromValueTree();
}

void ZenDecibelParameter::updateFromValueTree()
{
	float updateVal = state.getProperty(owner.valuePropertyID, defaultValue);
	DBG("In updateFromValueTree of " << this->paramID << " setting from state to: " << updateVal);
	setValue(state.getProperty(owner.valuePropertyID, defaultValue));
	//setUnnormalisedValue(state.getProperty(owner.valuePropertyID, defaultValue));
}

void ZenDecibelParameter::copyValueToValueTree()
{
	//DBG("In copyValueToValueTree of " << this->paramID << " setting property to: " << getValue());
	if (state.isValid())
		state.setProperty(owner.valuePropertyID, getValue(), owner.undoManager);
}

void ZenDecibelParameter::valueTreePropertyChanged(ValueTree& vt, const Identifier& prop)
{
	if (prop == owner.valuePropertyID)
		updateFromValueTree();
}

void ZenDecibelParameter::setUnnormalisedValue(float newUnnormalisedValue)
{
	////DBG("In setUnnormalizedvalue of " << this->paramID << " calling setValueNotifyingHost(decibelValueIn) with: " << newUnnormalisedValue);
	if (value.load() != newUnnormalisedValue)
	{
		const float newValue = DecibelConversions::mapDecibelsToProperNormalizedValue
			(newUnnormalisedValue, range.start, range.end, midValue);
		
		setValueNotifyingHost(newValue);
	}
}



//==============================================================================
//==============================================================================
#ifdef ZEN_UNIT_TESTS

/// ZenDecibelParameterTests: 
/// <seealso cref="ZenUnitTest" />
class ZenDecibelParameterTests : public ZenUnitTest
{
public:
	/// /*Initializes a new instance of the <see cref="ZenDecibelParameterTests"/> class.
	/// */
	ZenDecibelParameterTests() : ZenUnitTest("ZenDecibelParameter class") {}

	/// /* Runs the test.
	/// */
	void runTest() override
	{
		beginTest("Get&Set Values");

		ZenDecibelParameter decibelParam("testDBID", "Decibel param test",
			-96.0f, 12.0f, 0.0f, 0.0f, 0.0f);
		expectAlmostEqual(decibelParam.getDefaultValue(), 0.5f);
		expectAlmostEqual(decibelParam.getValue(), 0.5f);
		expectAlmostEqual(decibelParam.getValueInDB(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 1.0f);
		decibelParam.setValueRaw(12.0f);
		expectAlmostEqual(decibelParam.getValue(), 1.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), 12.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 3.98107f);
		decibelParam.setValueRaw(0.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.50f);
		expectAlmostEqual(decibelParam.getValueInDB(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 1.0f);
		decibelParam.setValueRaw(-18.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.40625f);//11
		expectAlmostEqual(decibelParam.getValueInDB(), -18.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.125893f);
		decibelParam.setValueRaw(-96.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), -96.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.0f);
		decibelParam.setValue(1.0f);
		expectAlmostEqual(decibelParam.getValue(), 1.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), 12.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 3.98107f);
		decibelParam.setValue(0.5f);
		expectAlmostEqual(decibelParam.getValue(), 0.50f); //20
		expectAlmostEqual(decibelParam.getValueInDB(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 1.0f);
		decibelParam.setValue(0.40625f);
		expectAlmostEqual(decibelParam.getValue(), 0.40625f);
		expectAlmostEqual(decibelParam.getValueInDB(), -18.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.125893f);
		decibelParam.setValue(0.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), -96.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.0f);
		decibelParam.setValueFromGain(3.98107f);
		expectAlmostEqual(decibelParam.getValue(), 1.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), 12.0f); //30
		expectAlmostEqual(decibelParam.getValueInGain(), 3.98107f);
		decibelParam.setValueFromGain(1.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.50f);
		expectAlmostEqual(decibelParam.getValueInDB(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 1.0f);
		decibelParam.setValueFromGain(0.125893f);
		expectAlmostEqual(decibelParam.getValue(), 0.40625f);
		expectAlmostEqual(decibelParam.getValueInDB(), -18.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.125893f);
		decibelParam.setValueFromGain(0.0f);
		expectAlmostEqual(decibelParam.getValue(), 0.0f);
		expectAlmostEqual(decibelParam.getValueInDB(), -96.0f);
		expectAlmostEqual(decibelParam.getValueInGain(), 0.0f);
	}
Example #12
0
void benchmark(){
    for(int i=0; i<numGoodData; i++){
        StringStream ss(goodData[i].str);
        NMEA nmea(ss);
        beginTest("parse %s", goodData[i].desc);
        nmea.update();
        benchFinish();
    }
}
Example #13
0
 //==============================================================================
 void runTest() override
 {
     beginTest ("getFrequencyInHertz");
     {
         MPENote note;
         note.initialNote = 60;
         note.totalPitchbendInSemitones = -0.5;
         expectEqualsWithinOneCent (note.getFrequencyInHertz(), 254.178);
     }
 }
void MonitorTests::startUpAndShutDownTest()
{
    beginTest("Start Up and Shut Down Test");

    Monitor monitor;
    monitor.startMonitoring();
    
    Thread::sleep(200);
    
    monitor.stop();
    
    Thread::sleep(100); // wait for thread to stop
    
}
Example #15
0
int timeStampTester (int handle1, int handle2)
{
  int i, j, k;
  
  setupHandles(handle1, handle2);
  
  for (k=0; k<NR_OF_TESTS; k++) {
    tMax=-2000000000;
    tMin=2000000000;
    h1Errors=0;
    h2Errors=0;
    memset(ndiff, 0, sizeof(ndiff));
    beginTest(testName[k]);
    
    tStart=timeGetTime();
    for (i=0; i<NUMBER_OF_BURSTS; i++) {
      Blipp();
      
      // Generate a set of messages to be sent
      buildMsgBurst[k]();
      
      // Send the generated messages
      sendMsgBurst(i, handle1, handle2);
      
      // Read all messages on both handles and compare timestamps...
      for (j=0; j<2*BURST_SIZE; j++) {
        
        // Read one message from each handle
        readMsgPair(i, j, handle1, handle2);
          
        // Make sure that both messages are equal and that they are the expected pair
        compareMsgPair(i, j);
        
        // Compare the timestamps
        compareTimeStamps(i, j);
      }
    }
    NoBlipp();
    printSomeStuff();
  }

  if (tMax-tMin > DIFF_ALLOWED)
    Error("Timestamps differ to much (%d us)\n", (tMax-tMin)*10);
  
  resetHandles(handle1, handle2);

  return TRUE;
}
Example #16
0
    void runTest()
    {
        beginTest ("Child Processes");

      #if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX
        ChildProcess p;

       #if JUCE_WINDOWS
        expect (p.start ("tasklist"));
       #else
        expect (p.start ("ls /"));
       #endif

        //String output (p.readAllProcessOutput());
        //expect (output.isNotEmpty());
      #endif
    }
Example #17
0
    void runTest()
    {
        beginTest ("AbstractFifo");

        int buffer [5000];
        AbstractFifo fifo (numElementsInArray (buffer));

        WriteThread writer (fifo, buffer, getRandom());

        int n = 0;
        Random r = getRandom();
        r.combineSeed (12345);

        for (int count = 100000; --count >= 0;)
        {
            int num = r.nextInt (6000) + 1;

            int start1, size1, start2, size2;
            fifo.prepareToRead (num, start1, size1, start2, size2);

            if (! (size1 >= 0 && size2 >= 0)
                    && (size1 == 0 || (start1 >= 0 && start1 < fifo.getTotalSize()))
                    && (size2 == 0 || (start2 >= 0 && start2 < fifo.getTotalSize())))
            {
                expect (false, "prepareToRead returned -ve values");
                break;
            }

            bool failed = false;

            for (int i = 0; i < size1; ++i)
                failed = (buffer [start1 + i] != n++) || failed;

            for (int i = 0; i < size2; ++i)
                failed = (buffer [start2 + i] != n++) || failed;

            if (failed)
            {
                expect (false, "read values were incorrect");
                break;
            }

            fifo.finishedRead (size1 + size2);
        }
    }
void ConsolidatedTests::CreateAndReleaseTests()
{
    beginTest("Create and Release Tests");
    initialize_field_manager(4);
    startserver(65002);
    
    register_callbacks(join_game,
                       leave_game,
                       take_cell,
                       get_size,
                       get_cell_player,
                       is_there_a_winner);
    
    Thread::sleep(5);
    stopserver();
    release_field_manager();
    Thread::sleep(50);
}
    void runTest()
    {
        beginTest ("TextDiff");

        testDiff (String::empty, String::empty);
        testDiff ("x", String::empty);
        testDiff (String::empty, "x");
        testDiff ("x", "x");
        testDiff ("x", "y");
        testDiff ("xxx", "x");
        testDiff ("x", "xxx");

        for (int i = 5000; --i >= 0;)
        {
            String s (createString());
            testDiff (s, createString());
            testDiff (s + createString(), s + createString());
        }
    }
Example #20
0
    void runTest() override
    {
        beginTest ("comparison operator");
        {
            MPEValue value1 = MPEValue::from7BitInt (7);
            MPEValue value2 = MPEValue::from7BitInt (7);
            MPEValue value3 = MPEValue::from7BitInt (8);

            expect (value1 == value1);
            expect (value1 == value2);
            expect (value1 != value3);
        }

        beginTest ("special values");
        {
            expectEquals (MPEValue::minValue().as7BitInt(), 0);
            expectEquals (MPEValue::minValue().as14BitInt(), 0);

            expectEquals (MPEValue::centreValue().as7BitInt(), 64);
            expectEquals (MPEValue::centreValue().as14BitInt(), 8192);

            expectEquals (MPEValue::maxValue().as7BitInt(), 127);
            expectEquals (MPEValue::maxValue().as14BitInt(), 16383);
        }

        beginTest ("zero/minimum value");
        {
            expectValuesConsistent (MPEValue::from7BitInt (0),  0, 0, -1.0f, 0.0f);
            expectValuesConsistent (MPEValue::from14BitInt (0), 0, 0, -1.0f, 0.0f);
        }

        beginTest ("maximum value");
        {
            expectValuesConsistent (MPEValue::from7BitInt (127),    127, 16383, 1.0f, 1.0f);
            expectValuesConsistent (MPEValue::from14BitInt (16383), 127, 16383, 1.0f, 1.0f);
        }

        beginTest ("centre value");
        {
            expectValuesConsistent (MPEValue::from7BitInt (64),    64, 8192, 0.0f, 0.5f);
            expectValuesConsistent (MPEValue::from14BitInt (8192), 64, 8192, 0.0f, 0.5f);
        }

        beginTest ("value halfway between min and centre");
        {
            expectValuesConsistent (MPEValue::from7BitInt (32),    32, 4096, -0.5f, 0.25f);
            expectValuesConsistent (MPEValue::from14BitInt (4096), 32, 4096, -0.5f, 0.25f);
        }
    }
Example #21
0
    void runTest() override
    {
        beginTest ("TextDiff");

        Random r = getRandom();

        testDiff (String::empty, String::empty);
        testDiff ("x", String::empty);
        testDiff (String::empty, "x");
        testDiff ("x", "x");
        testDiff ("x", "y");
        testDiff ("xxx", "x");
        testDiff ("x", "xxx");

        for (int i = 1000; --i >= 0;)
        {
            String s (createString (r));
            testDiff (s, createString (r));
            testDiff (s + createString (r), s + createString (r));
        }
    }
Example #22
0
/**
 * Just test it here, I'm lazy
 */
void RandomNumberGeneratorTests::test( int iter )
{
	beginTest();

	RandomNumberGenerator r;

	int i = 0;
	int cnt[7] = { 0,0,0,0,0,0,0 };
	std::cout << iter << " Random Number Generation 0-6:" << std::endl;

	while(++i != iter) 
	{
		cnt[r.nextNumber(6)]++;
	}
		
	for( i = 0; i < 7; ++i )
	{
		std::cout << i << ": " << cnt[i] << " (" << ((float) cnt[i] / (float) iter) * 100 << "%)" << std::endl; 
	}

	endTest();
}
void PitchProcessorUnitTest::runTest() {
	
	beginTest("PitchProcessor Unit Test");
	{
		Engine::PitchProcessor pitchProc;

		size_t nSamp = 32;
		float sampleRate = 44100.0f;

		pitchProc.PrepareToPlay(sampleRate, nSamp);

		float w;
		w = pitchProc.PitchToNormFreq(69.0f);
		expect(Utils::ApproxEqual(w, 440.0f/sampleRate));

		w = pitchProc.PitchToNormFreq(60.0f);
		expect(Utils::ApproxEqual(w, 261.63f / sampleRate, 0.001f));

		// TODO: test buffered versions
		//void PitchToFreq(Buffer& buf);
		//void PitchToFreq(Buffer const& inBuf, Buffer& outBuf);
	}
}
void MonitorTests::callBackTest()
{
    
    beginTest("CallBack Test");
    
    Monitor monitor;
    monitor.startMonitoring();
    
    ScopedPointer<SocketListener> listener = new SocketListener();
    listener->initializeSockets(40780, &monitor, "quark");
    
    pool->addJob(listener, false);
    
    while(pool->getNumJobs() > 0 )
    {
        Thread::sleep(5);
    }
    
    monitor.stop();
    expectEquals(true, listener->was_informed);

    
}
void ResamplingUnitTest::runTest()
{
    juce::ScopedPointer<IResampler> pResamp;

	// Basic Upsamplers
    {
		Buffer inBuf0(4);
		Buffer inBuf1(4);
        Buffer outBuf(16);
        
        float const inValsUp0[4] = {1.0f, -2.3f, -0.0f, 0.3f};
        float const inValsUp1[4] = {0.1f, 3.2f, -600.0f, 2.1f};

		juce::FloatVectorOperations::copy(inBuf0.Get(), inValsUp0, 4);
		juce::FloatVectorOperations::copy(inBuf1.Get(), inValsUp1, 4);

        beginTest("Testing ZeroPadUpsampler");
        {
            float expVals0[16] = { 1.0f, 0.0f, 0.0f, 0.0f, -2.3f, 0.0f, 0.0f, 0.0f,   -0.0f, 0.0f, 0.0f, 0.0f, 0.3f, 0.0f, 0.0f, 0.0f };
			float expVals1[16] = { 0.1f, 0.0f, 0.0f, 0.0f, 3.2f,  0.0f, 0.0f, 0.0f, -600.0f, 0.0f, 0.0f, 0.0f, 2.1f, 0.0f, 0.0f, 0.0f };
            
			pResamp = new Utils::ZeroPadUpsampler(4, false);
            pResamp->Process(outBuf, inBuf0);
			expect(CheckEquals_(outBuf, Buffer(expVals0, 16)));
            
			pResamp = new Utils::ZeroPadUpsampler(4, false);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 16)));

			juce::FloatVectorOperations::multiply(expVals0, 4.0f, 16);
			juce::FloatVectorOperations::multiply(expVals1, 4.0f, 16);

            pResamp = new Utils::ZeroPadUpsampler(4, true);
			pResamp->Process(outBuf, inBuf0);
			expect(CheckEquals_(outBuf, Buffer(expVals0, 16)));

			pResamp = new Utils::ZeroPadUpsampler(4, true);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 16)));
        }
        
        beginTest("Testing NearestUpsampler");
        {
			float expVals0[16] = { 1.0f, 1.0f, 1.0f, 1.0f, -2.3f, -2.3f, -2.3f, -2.3f,   -0.0f, -0.0f, -0.0f, -0.0f, 0.3f, 0.3f, 0.3f, 0.3f };
			float expVals1[16] = { 0.1f, 0.1f, 0.1f, 0.1f,  3.2f,  3.2f,  3.2f,  3.2f, -600.0f, -600.0f, -600.0f, -600.0f, 2.1f, 2.1f, 2.1f, 2.1f };

            pResamp = new Utils::NearestUpsampler(4);
			pResamp->Process(outBuf, inBuf0);
			expect(CheckEquals_(outBuf, Buffer(expVals0, 16)));

			pResamp = new Utils::NearestUpsampler(4);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 16)));
        }
        
        beginTest("Testing LinearInterpUpsampler");
        {
            {
				float expVals0[16] = { 0.0f, 0.25f, 0.50f, 0.75f, 1.0f, 0.175f, -0.65f, -1.475f, -2.3f, -1.725f, -1.15f, -0.575f, 0.0f, 0.075f, 0.15f, 0.225f };
				float expVals1[16] = { 0.0f, 0.025f, 0.05f, 0.075f, 0.1f, 0.875f, 1.65f, 2.425f, 3.2f, -147.6f, -298.4f, -449.2f, -600.0f, -449.475f, -298.95f, -148.425f };

                pResamp = new Utils::LinearInterpUpsampler(4, 2, false);
				pResamp->Process(outBuf, inBuf0);
                expect(CheckEquals_(outBuf, Buffer(expVals0, 16)));
				
				pResamp = new Utils::LinearInterpUpsampler(4, 2, false);
				pResamp->Process(outBuf, inBuf1);
				expect(CheckEquals_(outBuf, Buffer(expVals1, 16)));
            }
        
            {
				float expVals0[16] = { 0.25f, 0.50f, 0.75f, 1.0f, 0.175f, -0.65f, -1.475f, -2.3f, -1.725f, -1.15f, -0.575f, 0.0f, 0.075f, 0.15f, 0.225f, 0.3f };
				float expVals1[16] = { 0.025f, 0.05f, 0.075f, 0.1f, 0.875f, 1.65f, 2.425f, 3.2f, -147.6f, -298.4f, -449.2f, -600.0f, -449.475f, -298.95f, -148.425f, 2.1f };

                pResamp = new Utils::LinearInterpUpsampler(4, 2, true);
				pResamp->Process(outBuf, inBuf0);
                expect(CheckEquals_(outBuf, Buffer(expVals0, 16)));

				pResamp = new Utils::LinearInterpUpsampler(4, 2, true);
				pResamp->Process(outBuf, inBuf1);
				expect(CheckEquals_(outBuf, Buffer(expVals1, 16)));
            }
        }
    }
    
	// Basic Downsamplers
    {
        Buffer inBuf0(16);
		Buffer inBuf1(16);
        
        float const inValsDown0[16] = {1.0f, -2.3f, -0.0f, 0.3f, 4.1f, -200.0f, 3.14f, 2.71f, -6.0f, 4.2f, 0.01f, -10.0f, -0.0f, 512.0f, -2.1f, 6.0f};
        float const inValsDown1[16] = {0.1f, 3.2f, -600.0f, 2.1f, 3.14f, -1.0f, 6.2f, -7.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, -1.5f, 4.01f, 2.2f};
        juce::FloatVectorOperations::copy(inBuf0.Get(), inValsDown0, 16);
        juce::FloatVectorOperations::copy(inBuf1.Get(), inValsDown1, 16);
        
        beginTest("Testing NaiveDownsampler");
        {
            Buffer outBuf(4);
        
            float expVals0[4] = {inValsDown0[0], inValsDown0[4], inValsDown0[8], inValsDown0[12]};
            float expVals1[4] = {inValsDown1[0], inValsDown1[4], inValsDown1[8], inValsDown1[12]};
            
            pResamp = new Utils::NaiveDownsampler(4);
			pResamp->Process(outBuf, inBuf0);
            expect(CheckEquals_(outBuf, Buffer(expVals0, 4)));

			pResamp = new Utils::NaiveDownsampler(4);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 4)));

            juce::FloatVectorOperations::multiply(expVals0, 4.0f, 4);
            juce::FloatVectorOperations::multiply(expVals1, 4.0f, 4);
            
            pResamp = new Utils::NaiveDownsampler(4, true);
			pResamp->Process(outBuf, inBuf0);
			expect(CheckEquals_(outBuf, Buffer(expVals0, 4)));

			pResamp = new Utils::NaiveDownsampler(4, true);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 4)));
        }
        
        beginTest("Testing AveragingDownsampler");
        {
            Buffer outBuf(4);
        
            #define AVG4(X, N) (X[N] + X[N+1] + X[N+2] + X[N+3]) / 4.0f
            #define AVG4x4(X) {AVG4(X,0), AVG4(X,4), AVG4(X,8), AVG4(X,12)}
        
            float expVals0[4] = AVG4x4(inValsDown0);
            float expVals1[4] = AVG4x4(inValsDown1);

            #undef AVG4
            #undef AVG4x4
            
            pResamp = new Utils::AveragingDownsampler(4);
			pResamp->Process(outBuf, inBuf0);
            expect(CheckEquals_(outBuf, Buffer(expVals0, 4)));
			
			pResamp = new Utils::AveragingDownsampler(4);
			pResamp->Process(outBuf, inBuf1);
			expect(CheckEquals_(outBuf, Buffer(expVals1, 4)));
        }
	}
	
	// IIR Downsamplers
	/*
	These tests fail. I'm not sure why.
	
	I suspect it's an error in measuring the sine amplitude, but it's also
	possible there's a problem with the filter itself - either something's
	wrong with the filter design, or it's a digital precision issue, or it's
	a good-ol' bug in the IIR downsamplers.
	
	I'm guessing it's not a precision issue, because if so, I suspect the
	high-order version would perform much worse than the cascaded-biquad
	version, and they actually do quite similarly.
	*/
	{
		size_t const nSamp = 65536;
		Buffer buf(nSamp);
		
		std::vector<float> const freqs = {
			100.f, 440.f, 1000.f, 3000.f, 10000.f, 20000.f, // Audible freqs
			22000.f, 24100.f, 28000.f,
			40e3f, 47e3f, 49e3f, 60e3f,
			68.2e3f, 76e3f, // Will alias to 20 kHz at 44.1 and 48, respectively
			80e3f, 88.1e3f, 90e3f, 95.9e3f
		};

		for (size_t n = 0; n < 4; ++n) {

			juce::String testName;
			float sampleRate;
			size_t nResamp;

			switch (n) {
			case 0:
				pResamp = new Utils::IirDownsampler_176_44();
				testName = "Testing IIR resampler 176.4 kHz -> 44.1 kHz";
				sampleRate = 176400.f;
				nResamp = 4;
				break;
			case 1:
				pResamp = new Utils::IirDownsampler_192_48();
				testName = "Testing IIR resampler 192 kHz -> 48 kHz";
				sampleRate = 192000.f;
				nResamp = 4;
				break;
			case 2:
				pResamp = new Utils::IirDownsampler_176_88();
				testName = "Testing IIR resampler 176.4 kHz -> 88.2 kHz";
				sampleRate = 176400.f;
				nResamp = 2;
				break;
			case 3:
				pResamp = new Utils::IirDownsampler_192_96();
				testName = "Testing IIR resampler 192 kHz -> 96 kHz";
				sampleRate = 192000.f;
				nResamp = 2;
				break;
			default:
				std::cout << "ERROR: n out of bounds\n";
				expect(false);
			}

			
			beginTest(testName);

			Buffer downBuf(nSamp / nResamp);

			std::vector<floatPair> results;

			sample_t phase = 0.f;
			for (auto it = freqs.begin(); it != freqs.end(); ++it) {

				float f = *it;

				float w = f / sampleRate;

				if (w > 0.5f) break;

				phase = GenerateSine(buf, w, phase);

				downBuf.Clear(); // Shouldn't be necessary?

				pResamp->Process(downBuf, buf);

				float ampl = Detail::GetSinAmpdB(downBuf, 1000);
				results.push_back(floatPair(f, ampl));
			}

			float const passbandFailThresh = 0.75f;
			float const aliasFailThresh = -60.0f;
			float maxPassbandError = 0.0f;
			float maxAlias = -99999.9f;

			for (auto it = results.begin(); it != results.end(); ++it) {
				float const inFreq = it->first;
				float const finalFreq = Detail::CalcAliasedFreq(inFreq, sampleRate/nResamp);
				bool const bAlias = !Utils::ApproxEqual(inFreq, finalFreq, 1.0f);
				
				float const ampl = it->second;

				if (inFreq <= 20001.f) {
					maxPassbandError = std::max(maxPassbandError, abs(ampl));
					std::cout << "Audible:    " << inFreq << ", ampl: " << ampl << " dB\n";
				}
				else if (finalFreq <= 20001.f) {
					maxAlias = std::max(maxAlias, ampl);
					std::cout << "Alias:      " << inFreq << " => " << finalFreq << ", ampl: " << ampl << " dB\n";
				}
				else {
					// Don't care about value, but print
					if (!bAlias) {
						std::cout << "Transition: " << inFreq << ", ampl: " << ampl << " dB\n";
					} 
					else {
						std::cout << "Transition: " << inFreq << " => " << finalFreq << ", ampl: " << ampl << " dB\n";
					}
				}
			}

			if (maxPassbandError > passbandFailThresh)
				std::cout << "Fail: max passband error " << maxPassbandError << " dB\n";

			expect(maxPassbandError <= passbandFailThresh);

			if (maxAlias > aliasFailThresh)
				std::cout << "Fail: max aliasing " << maxAlias << " dB\n";

			expect(maxAlias <= aliasFailThresh);
		}
    }
}
void MonitorTests::firstTest()
{
    beginTest("Testing The Tester");
    expect(true);
    expectEquals(true, !false);
}
/****************************************************************************
Desc:
****************************************************************************/
RCODE IRegressionTestImpl::leftoverIndexKeyDefectTest( void)
{
	RCODE					rc = NE_XFLM_OK;
	IF_DataVector *	pSearchKey = NULL;
	IF_DOMNode *		pNode = NULL;
	FLMBOOL				bDibCreated = FALSE;
	FLMBOOL				bTransBegun = FALSE;
	IF_DOMNode *		pDoc = NULL;
	IF_DOMNode *		pAttr = NULL;
	IF_DOMNode *		pIndex = NULL;
	IF_DOMNode *		pComp = NULL;
	FLMUINT				uiIxValName = 0;
	char					szBuf[100];
	FLMUINT				uiTmp;

	beginTest(
		"Unlink Node Bad Ix Key Defect Test",
		"",
		"Self-explanatory",
		"");

	if ( RC_BAD( rc = initCleanTestState( DB_NAME_STR)))
	{
		goto Exit;
	}
	bDibCreated = TRUE;

	if ( RC_BAD( rc = m_pDb->transBegin( XFLM_UPDATE_TRANS)))
	{
		MAKE_ERROR_STRING( "transBegin failed.", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = TRUE;

	if ( RC_BAD( rc = m_pDb->createElementDef( 
		NULL, "indexed val", XFLM_TEXT_TYPE, &uiIxValName)))
	{
		MAKE_ERROR_STRING( "createElementDef failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createDocument( 
		XFLM_DATA_COLLECTION,
		&pDoc)))
	{
		MAKE_ERROR_STRING( "createDocument failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pDoc->createNode( 
		m_pDb, ELEMENT_NODE, uiIxValName, XFLM_FIRST_CHILD,
		&pNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->documentDone( pDoc)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	// create an index definition that references the elem we made

	if ( RC_BAD( rc = m_pDb->createRootElement(
		XFLM_DICT_COLLECTION,
		ELM_INDEX_TAG,
		&pIndex)))
	{
		MAKE_ERROR_STRING( "createRootElement failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pIndex->createAttribute( m_pDb, ATTR_NAME_TAG, &pAttr)))
	{
		MAKE_ERROR_STRING( "createAttribute failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pAttr->setUTF8( m_pDb, 
		(FLMBYTE *)"index_2")))
	{
		MAKE_ERROR_STRING( "setUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pIndex->createAttribute( m_pDb, ATTR_DICT_NUMBER_TAG, &pAttr)))
	{
		MAKE_ERROR_STRING( "createAttribute failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pAttr->setUINT( m_pDb, 123)))
	{
		MAKE_ERROR_STRING( "setUINT failed.", m_szDetails, rc);
		goto Exit;
	}

	// xflaim:ElementPath must have one or more xflaim:ElementComponent
	// or one or more xflaim:AttributeComponent sub-elements

	if ( RC_BAD( rc = pIndex->createNode(
		m_pDb,
		ELEMENT_NODE,
		ELM_ELEMENT_COMPONENT_TAG,
		XFLM_FIRST_CHILD,
		&pComp)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pComp->createAttribute(
		m_pDb,
		ATTR_DICT_NUMBER_TAG,
		&pAttr)))
	{
		MAKE_ERROR_STRING( "createAttribute failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pAttr->setUINT( m_pDb, uiIxValName)))
	{
		MAKE_ERROR_STRING( "setUINT failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pComp->createAttribute(
		m_pDb,
		ATTR_KEY_COMPONENT_TAG,
		&pAttr)))
	{
		MAKE_ERROR_STRING( "createAttribute failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pAttr->setUINT( m_pDb, 1)))
	{
		MAKE_ERROR_STRING( "setUINT failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pComp->createAttribute(
		m_pDb,
		ATTR_REQUIRED_TAG,
		&pAttr)))
	{
		MAKE_ERROR_STRING( "createAttribute failed.", m_szDetails, rc);
		goto Exit;

	}

	if ( RC_BAD( rc = pAttr->setUINT( m_pDb, 1)))
	{
		MAKE_ERROR_STRING( "setUINT failed.", m_szDetails, rc);
		goto Exit;
	}

	if (RC_BAD( rc = m_pDb->documentDone( pIndex)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDbSystem->createIFDataVector( &pSearchKey)))
	{
		MAKE_FLM_ERROR_STRING( "createIFDataVector failed", m_szDetails, rc);
		goto Exit;
	}

	// we should now have one empty key for this index

	if ( RC_BAD( rc = m_pDb->keyRetrieve( 123, NULL, XFLM_FIRST, pSearchKey)))
	{
		MAKE_ERROR_STRING( "keyRetrieve failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( pSearchKey->getDataLength( 0) != 0)
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "Invalid key found.", m_szDetails, rc);
		goto Exit;
	}

	// now set a value

	if ( RC_BAD( rc = pNode->setUTF8( m_pDb,
		(FLMBYTE *)"new value")))
	{
		MAKE_ERROR_STRING( "setUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->documentDone( pDoc)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	// we should have a key with the new value in it

	if ( RC_BAD( rc = m_pDb->keyRetrieve( 123, NULL, XFLM_FIRST, pSearchKey)))
	{
		MAKE_ERROR_STRING( "keyRetrieve failed.", m_szDetails, rc);
		goto Exit;
	}

	uiTmp = sizeof( szBuf);
	if ( RC_BAD( rc = pSearchKey->getUTF8( 0, (FLMBYTE *)szBuf, &uiTmp)))
	{
		MAKE_ERROR_STRING( "getUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( f_strcmp( szBuf, "new value") != 0)
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "invalid key found.", m_szDetails, rc);
		goto Exit;
	}

	// now delete pNode

	if ( RC_BAD( rc = pNode->deleteNode( m_pDb)))
	{
		MAKE_ERROR_STRING( "deleteNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->documentDone( pDoc)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	// there should be no key now

	if ( RC_OK( rc = m_pDb->keyRetrieve( 123, NULL, XFLM_FIRST, pSearchKey)))
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "Invalid key found.", m_szDetails, rc);
		goto Exit;
	}

	if ( rc != NE_XFLM_EOF_HIT)
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "Unexpected rc from keyRetrieve", m_szDetails, rc);
		goto Exit;
	}

	// create the node again and stream in the data. This will force the
	// creation of a DATA_NODE to hold the data

	if ( RC_BAD( rc = pDoc->createNode( 
		m_pDb, ELEMENT_NODE, uiIxValName, XFLM_FIRST_CHILD,
		&pNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pNode->setUTF8( m_pDb, 
		(FLMBYTE *)"Streamed ", 9, FALSE)))
	{
		MAKE_ERROR_STRING( "setUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pNode->setUTF8( m_pDb, 
		(FLMBYTE *)"in ", 3, FALSE)))
	{
		MAKE_ERROR_STRING( "setUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pNode->setUTF8( m_pDb,
		(FLMBYTE *)"value", 5, TRUE)))
	{
		MAKE_ERROR_STRING( "setUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->documentDone( pDoc)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	// we should have a new key now

	if ( RC_BAD( rc = m_pDb->keyRetrieve( 123, NULL, XFLM_FIRST, pSearchKey)))
	{
		MAKE_ERROR_STRING( "keyRetrieve failed.", m_szDetails, rc);
		goto Exit;
	}

	uiTmp = sizeof( szBuf);
	if ( RC_BAD( rc = pSearchKey->getUTF8( 0, (FLMBYTE *)szBuf, &uiTmp)))
	{
		MAKE_ERROR_STRING( "getUTF8 failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( f_strcmp( szBuf, "Streamed in value") != 0)
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "invalid key found.", m_szDetails, rc);
		goto Exit;
	}

	// delete the node

	if ( RC_BAD( rc = pNode->deleteNode( m_pDb)))
	{
		MAKE_ERROR_STRING( "deleteNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->documentDone( pDoc)))
	{
		MAKE_ERROR_STRING( "documentDone failed.", m_szDetails, rc);
		goto Exit;
	}

	// we should have no key left

	if ( RC_OK( rc = m_pDb->keyRetrieve( 123, NULL, XFLM_FIRST, pSearchKey)))
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "Invalid key found.", m_szDetails, rc);
		goto Exit;
	}

	if ( rc != NE_XFLM_EOF_HIT)
	{
		rc = RC_SET( NE_XFLM_DATA_ERROR);
		MAKE_ERROR_STRING( "Unexpected rc from keyRetrieve", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->transCommit()))
	{
		MAKE_ERROR_STRING( "commitTrans failed.", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = FALSE;

	endTest("PASS");


Exit:

	if( pSearchKey)
	{
		pSearchKey->Release();
	}

	if( pNode)
	{
		pNode->Release();
	}

	if( pAttr)
	{
		pAttr->Release();
	}

	if( pIndex)
	{
		pIndex->Release();
	}

	if( pDoc)
	{
		pDoc->Release();
	}

	if( pComp)
	{
		pComp->Release();
	}

	if( RC_BAD( rc))
	{
		endTest("FAIL");
	}

	if( bTransBegun)
	{
		if( RC_OK( rc))
		{
			rc = m_pDb->transCommit();
		}
		else
		{
			m_pDb->transAbort();
		}
	}

	shutdownTestState( DB_NAME_STR, bDibCreated);
	return( rc);
}
/****************************************************************************
Desc:
****************************************************************************/
RCODE IRegressionTestImpl::nestedElementIndexDefectTest( void)
{
	RCODE					rc = NE_XFLM_OK;
	const char *		pszDoc = 
		"<foo bar=\"dogmaticperipateticaustere\">"
		" <foo>123</foo>"
		"</foo>";
	const char *		pszIndex = "<xflaim:Index "
			"xmlns:xflaim=\"http://www.novell.com/XMLDatabase/Schema\" "
			"xflaim:name=\"foo+bar_IX\" "
			"xflaim:DictNumber=\"99\">"
			"<xflaim:ElementComponent xflaim:name=\"foo\">"
				"<xflaim:AttributeComponent "
					"xflaim:name=\"bar\" "
					"xflaim:KeyComponent=\"1\" "
					"xflaim:Required=\"yes\" "
					"xflaim:type=\"string\" "
					"xflaim:IndexOn=\"value\" "
					"xflaim:Limit=\"18\"/>"
			"</xflaim:ElementComponent>"
		"</xflaim:Index>";

	IF_DataVector *	pSearchKey = NULL;
	FLMBOOL				bTransBegun = FALSE;
	FLMBOOL				bDibCreated = FALSE;

	beginTest( 	
		"Nested Element Index Defect Test",
		"",
		"Self-explanatory",
		"");

	if ( RC_BAD( rc = initCleanTestState( DB_NAME_STR)))
	{
		goto Exit;
	}
	bDibCreated = TRUE;

	if ( RC_BAD( rc = m_pDb->transBegin( XFLM_UPDATE_TRANS)))
	{
		MAKE_ERROR_STRING( "beginTrans failed.", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = TRUE;

	if ( RC_BAD( rc = importBuffer( pszDoc, XFLM_DATA_COLLECTION)))
	{
		goto Exit;
	}

	if ( RC_BAD( rc = importBuffer( pszIndex, XFLM_DICT_COLLECTION)))
	{
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->transCommit()))
	{
		MAKE_FLM_ERROR_STRING( "transCommit failed", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = FALSE;

	// A key better have been generated...

	if ( RC_BAD( rc = m_pDb->keyRetrieve(
		99, NULL, XFLM_FIRST | XFLM_MATCH_DOC_ID, pSearchKey)))
	{
		MAKE_FLM_ERROR_STRING( "No index keys generated", m_szDetails, rc);
		goto Exit;
	}

	endTest("PASS");

Exit:

	if ( RC_BAD( rc))
	{
		endTest("FAIL");
	}

	if ( pSearchKey)
	{
		pSearchKey->Release();
	}

	if ( bTransBegun)
	{
		if ( RC_OK( rc))
		{
			rc = m_pDb->transCommit();
		}
		else
		{
			m_pDb->transAbort();
		}
	}

	shutdownTestState( DB_NAME_STR, bDibCreated);
	return rc;
}
Example #29
0
    void runTest() override
    {
        beginTest ("initialisation");
        {
            {
                MPEZone zone (1, 10);

                expectEquals (zone.getMasterChannel(), 1);
                expectEquals (zone.getNumNoteChannels(), 10);
                expectEquals (zone.getFirstNoteChannel(), 2);
                expectEquals (zone.getLastNoteChannel(), 11);
                expectEquals (zone.getPerNotePitchbendRange(), 48);
                expectEquals (zone.getMasterPitchbendRange(), 2);

                expect (zone.isUsingChannel (1));
                expect (zone.isUsingChannel (2));
                expect (zone.isUsingChannel (10));
                expect (zone.isUsingChannel (11));
                expect (! zone.isUsingChannel (12));
                expect (! zone.isUsingChannel (16));

                expect (! zone.isUsingChannelAsNoteChannel (1));
                expect (zone.isUsingChannelAsNoteChannel (2));
                expect (zone.isUsingChannelAsNoteChannel (10));
                expect (zone.isUsingChannelAsNoteChannel (11));
                expect (! zone.isUsingChannelAsNoteChannel (12));
                expect (! zone.isUsingChannelAsNoteChannel (16));
            }
            {
                MPEZone zone (5, 4);

                expectEquals (zone.getMasterChannel(), 5);
                expectEquals (zone.getNumNoteChannels(), 4);
                expectEquals (zone.getFirstNoteChannel(), 6);
                expectEquals (zone.getLastNoteChannel(), 9);
                expectEquals (zone.getPerNotePitchbendRange(), 48);
                expectEquals (zone.getMasterPitchbendRange(), 2);

                expect (! zone.isUsingChannel (1));
                expect (! zone.isUsingChannel (4));
                expect (zone.isUsingChannel (5));
                expect (zone.isUsingChannel (6));
                expect (zone.isUsingChannel (8));
                expect (zone.isUsingChannel (9));
                expect (! zone.isUsingChannel (10));
                expect (! zone.isUsingChannel (16));

                expect (! zone.isUsingChannelAsNoteChannel (5));
                expect (zone.isUsingChannelAsNoteChannel (6));
                expect (zone.isUsingChannelAsNoteChannel (8));
                expect (zone.isUsingChannelAsNoteChannel (9));
                expect (! zone.isUsingChannelAsNoteChannel (10));
            }

        }

        beginTest ("getNoteChannelRange");
        {
            MPEZone zone (2, 10);

            Range<int> noteChannelRange = zone.getNoteChannelRange();
            expectEquals (noteChannelRange.getStart(), 3);
            expectEquals (noteChannelRange.getEnd(), 13);
        }

        beginTest ("setting master pitchbend range");
        {
            MPEZone zone (1, 10);

            zone.setMasterPitchbendRange (96);
            expectEquals (zone.getMasterPitchbendRange(), 96);
            zone.setMasterPitchbendRange (0);
            expectEquals (zone.getMasterPitchbendRange(), 0);

            expectEquals (zone.getPerNotePitchbendRange(), 48);
        }

        beginTest ("setting per-note pitchbend range");
        {
            MPEZone zone (1, 10);

            zone.setPerNotePitchbendRange (96);
            expectEquals (zone.getPerNotePitchbendRange(), 96);
            zone.setPerNotePitchbendRange (0);
            expectEquals (zone.getPerNotePitchbendRange(), 0);

            expectEquals (zone.getMasterPitchbendRange(), 2);
        }

        beginTest ("checking overlap");
        {
            testOverlapsWith (1, 10, 1, 10, true);
            testOverlapsWith (1, 4,  6, 3,  false);
            testOverlapsWith (1, 4,  8, 3,  false);
            testOverlapsWith (2, 10, 2, 8,  true);
            testOverlapsWith (1, 10, 3, 2,  true);
            testOverlapsWith (3, 10, 5, 9,  true);
        }

        beginTest ("truncating");
        {
            testTruncateToFit (1, 10, 3, 10, true,  1, 1);
            testTruncateToFit (3, 10, 1, 10, false, 3, 10);
            testTruncateToFit (1, 10, 5, 8,  true,  1, 3);
            testTruncateToFit (5, 8,  1, 10, false, 5, 8);
            testTruncateToFit (1, 10, 4, 3,  true,  1, 2);
            testTruncateToFit (4, 3,  1, 10, false, 4, 3);
            testTruncateToFit (1, 3,  5, 3,  true,  1, 3);
            testTruncateToFit (5, 3,  1, 3,  false, 5, 3);
            testTruncateToFit (1, 3,  7, 3,  true,  1, 3);
            testTruncateToFit (7, 3,  1, 3,  false, 7, 3);
            testTruncateToFit (1, 10, 2, 10, false, 1, 10);
            testTruncateToFit (2, 10, 1, 10, false, 2, 10);
        }
    }
/****************************************************************************
Desc:
****************************************************************************/
RCODE IRegressionTestImpl::truncatedValueFromStoreDefectTest( void)
{
	RCODE					rc = NE_XFLM_OK;
	FLMBOOL				bTransBegun = FALSE;
	FLMBOOL				bDibCreated = FALSE;
	FLMUINT				uiRootId = 0;
	FLMUINT				uiTextValId = 0;
	FLMUINT				uiNumVal1Id = 0;
	FLMUINT				uiNumVal2Id = 0;
	FLMUINT				uiNumVal3Id = 0;
	FLMUINT				uiBinValId = 0;
	FLMBYTE				pucBinVal[] = BIN_VAL;
	FLMUINT64			ui64RootId = 0;
	FLMUINT				uiNameId = 0;
	IF_DOMNode *		pRootNode = NULL;
	IF_DOMNode *		pValNode = NULL;

	beginTest( 	
		"Truncated Value From Store Defect Test",
		"Make sure values make it back from disk intact",
		"Add values to database/close database/open database/verify values",
		"");

	if ( RC_BAD( rc = initCleanTestState( DB_NAME_STR)))
	{
		goto Exit;
	}
	bDibCreated = TRUE;

	if ( RC_BAD( rc = m_pDb->transBegin( XFLM_UPDATE_TRANS)))
	{
		MAKE_ERROR_STRING( "transBegin failed", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = TRUE;

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"root",
		XFLM_NODATA_TYPE,
		&uiRootId)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"text_val",
		XFLM_TEXT_TYPE,
		&uiTextValId)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"uint64_val",
		XFLM_NUMBER_TYPE,
		&uiNumVal1Id)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"int64_val",
		XFLM_NUMBER_TYPE,
		&uiNumVal2Id)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"uint_val",
		XFLM_NUMBER_TYPE,
		&uiNumVal3Id)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createElementDef(
		NULL,
		"bin_val",
		XFLM_BINARY_TYPE,
		&uiBinValId)))
	{
		MAKE_ERROR_STRING( "createElementDef failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->createRootElement(
		XFLM_DATA_COLLECTION,
		uiRootId,
		&pRootNode)))
	{
		MAKE_ERROR_STRING( "createRootElement failed.", m_szDetails, rc);
		goto Exit;
	}
	
	if( RC_BAD( rc = pRootNode->getNodeId( m_pDb, &ui64RootId)))
	{
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->createNode( m_pDb,
		ELEMENT_NODE, uiTextValId, XFLM_FIRST_CHILD,	&pValNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pValNode->setUTF8( m_pDb, 
		(FLMBYTE *)TEXT_VAL, f_strlen( TEXT_VAL))))
	{
		MAKE_ERROR_STRING( "setUTF8 failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->createNode( m_pDb,
		ELEMENT_NODE, uiNumVal1Id, XFLM_FIRST_CHILD,	&pValNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pValNode->setUINT64( m_pDb, UINT64_VAL)))
	{
		MAKE_ERROR_STRING( "setUINT64 failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->createNode( m_pDb,
		ELEMENT_NODE, uiNumVal2Id, XFLM_FIRST_CHILD,	&pValNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pValNode->setINT64( m_pDb, INT64_VAL)))
	{
		MAKE_ERROR_STRING( "setINT64 failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->createNode( m_pDb,
		ELEMENT_NODE, uiNumVal3Id, XFLM_FIRST_CHILD,	&pValNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pValNode->setUINT( m_pDb, UINT_VAL)))
	{
		MAKE_ERROR_STRING( "setUINT failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->createNode( m_pDb,
		ELEMENT_NODE, uiBinValId, XFLM_FIRST_CHILD,	&pValNode)))
	{
		MAKE_ERROR_STRING( "createNode failed.", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pValNode->setBinary( m_pDb, pucBinVal, BIN_VAL_LEN, TRUE)))
	{
		MAKE_ERROR_STRING( "setBinary failed", m_szDetails, rc);
		goto Exit;
	}

	// close the database to force the values to disk

	if ( RC_BAD( rc = m_pDb->transCommit()))
	{
		goto Exit;
	}
	bTransBegun = FALSE;

	pRootNode->Release();
	pRootNode = NULL;
	pValNode->Release();
	pValNode = NULL;
	m_pDb->Release();
	m_pDb = NULL;

	if( RC_BAD( rc = m_pDbSystem->dbOpen( DB_NAME_STR, NULL, NULL, 
		NULL, FALSE, &m_pDb)))
	{
		MAKE_ERROR_STRING( "dbOpen failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = m_pDb->transBegin( XFLM_READ_TRANS)))
	{
		MAKE_ERROR_STRING( "transBegin failed", m_szDetails, rc);
		goto Exit;
	}
	bTransBegun = TRUE;

	if ( RC_BAD( rc = m_pDb->getNode(
		XFLM_DATA_COLLECTION, ui64RootId, &pRootNode)))
	{
		MAKE_ERROR_STRING( "getNode failed", m_szDetails, rc);
		goto Exit;
	}

	if ( RC_BAD( rc = pRootNode->getFirstChild(
		m_pDb, &pValNode)))
	{
		MAKE_ERROR_STRING( "getFirstChild failed", m_szDetails, rc);
		goto Exit;
	}

	for(;;)
	{
		if ( RC_BAD( rc = pValNode->getNameId( m_pDb, &uiNameId)))
		{
			MAKE_ERROR_STRING( "getNameId failed", m_szDetails, rc);
			goto Exit;
		}

		if ( uiNameId == uiTextValId)
		{
			char szTemp[100];

			if ( RC_BAD( rc = pValNode->getUTF8( 
				m_pDb, (FLMBYTE *)szTemp, sizeof( szTemp), 
				0, sizeof(szTemp) -1)))
			{
				MAKE_ERROR_STRING( "getUTF8 failed", m_szDetails, rc);
				goto Exit;
			}

			if ( f_strcmp( szTemp, TEXT_VAL) != 0)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Unexpected text value found", m_szDetails, rc);
				goto Exit;
			}
			// flag this name id as visited
			uiTextValId = 0;
		}
		else if ( uiNameId == uiNumVal1Id)
		{
			FLMUINT64	ui64Temp;

			if ( RC_BAD( rc = pValNode->getUINT64( m_pDb, &ui64Temp)))
			{
				MAKE_ERROR_STRING( "getUINT64 Failed", m_szDetails, rc);
				goto Exit;
			}

			if ( ui64Temp != UINT64_VAL)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Unexpected uint64 value found", m_szDetails, rc);
				goto Exit;
			}
			uiNumVal1Id = 0;
		}
		else if ( uiNameId == uiNumVal2Id)
		{
			FLMINT64	i64Temp;

			if ( RC_BAD( rc = pValNode->getINT64( m_pDb, &i64Temp)))
			{
				goto Exit;
			}

			if ( i64Temp != INT64_VAL)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Unexpected int64 value found", m_szDetails, rc);
				goto Exit;
			}
			uiNumVal2Id = 0;
		}
		else if ( uiNameId == uiNumVal3Id)
		{
			FLMUINT	uiTemp;

			if ( RC_BAD( rc = pValNode->getUINT( m_pDb, &uiTemp)))
			{
				MAKE_ERROR_STRING( "getUINT failed", m_szDetails, rc);
				goto Exit;
			}

			if ( uiTemp != UINT_VAL)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Unexpected uint value found", m_szDetails, rc);
				goto Exit;
			}
			uiNumVal3Id = 0;
		}
		else if ( uiNameId == uiBinValId)
		{
			FLMBYTE	pucTemp[BIN_VAL_LEN];
			FLMUINT	uiTmp;

			if ( RC_BAD( rc = pValNode->getBinary( 
				m_pDb,
				pucTemp,
				0,
				sizeof(pucTemp),
				&uiTmp)))
			{
				MAKE_FLM_ERROR_STRING( "getBinary failed.", m_szDetails, rc);
				goto Exit;
			}

			if ( uiTmp != BIN_VAL_LEN ||
				f_memcmp( pucTemp, pucBinVal, uiTmp) != 0)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Unexpected binary value found", m_szDetails, rc);
				goto Exit;
			}
			uiBinValId = 0;
		}
		else
		{
			rc = RC_SET( NE_XFLM_DATA_ERROR);
			MAKE_ERROR_STRING( "Unexpected node found", m_szDetails, rc);
			goto Exit;
		}

		if ( RC_BAD( rc = pValNode->getNextSibling( m_pDb, &pValNode)))
		{
			if ( rc != NE_XFLM_DOM_NODE_NOT_FOUND || uiTextValId ||
				uiNumVal1Id || uiNumVal2Id || uiNumVal3Id || uiBinValId)
			{
				rc = RC_SET( NE_XFLM_DATA_ERROR);
				MAKE_ERROR_STRING( "Node not found", m_szDetails, rc);
				goto Exit;
			}
			else
			{
				rc = NE_XFLM_OK;
				break;
			}
		}
	}

	endTest("PASS");

Exit:

	if( pRootNode)
	{
		pRootNode->Release();
	}

	if( pValNode)
	{
		pValNode->Release();
	}

	if( RC_BAD( rc))
	{
		endTest("FAIL");
	}

	if( bTransBegun)
	{
		if( RC_OK( rc))
		{
			rc = m_pDb->transCommit();
		}
		else
		{
			m_pDb->transAbort();
		}
	}

	shutdownTestState( DB_NAME_STR, bDibCreated);
	return( rc);
}