annotate src/portaudio_20140130/qa/paqa_errs.c @ 56:af97cad61ff0

Add updated build of PortAudio for OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 03 Jan 2017 15:10:52 +0000
parents 7ddb4fc30dac
children
rev   line source
Chris@39 1 /** @file paqa_errs.c
Chris@39 2 @ingroup qa_src
Chris@39 3 @brief Self Testing Quality Assurance app for PortAudio
Chris@39 4 Do lots of bad things to test error reporting.
Chris@39 5 @author Phil Burk http://www.softsynth.com
Chris@39 6 Pieter Suurmond adapted to V19 API.
Chris@39 7 */
Chris@39 8 /*
Chris@39 9 * $Id: paqa_errs.c 1756 2011-09-08 06:09:29Z philburk $
Chris@39 10 *
Chris@39 11 * This program uses the PortAudio Portable Audio Library.
Chris@39 12 * For more information see: http://www.portaudio.com
Chris@39 13 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
Chris@39 14 *
Chris@39 15 * Permission is hereby granted, free of charge, to any person obtaining
Chris@39 16 * a copy of this software and associated documentation files
Chris@39 17 * (the "Software"), to deal in the Software without restriction,
Chris@39 18 * including without limitation the rights to use, copy, modify, merge,
Chris@39 19 * publish, distribute, sublicense, and/or sell copies of the Software,
Chris@39 20 * and to permit persons to whom the Software is furnished to do so,
Chris@39 21 * subject to the following conditions:
Chris@39 22 *
Chris@39 23 * The above copyright notice and this permission notice shall be
Chris@39 24 * included in all copies or substantial portions of the Software.
Chris@39 25 *
Chris@39 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@39 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@39 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Chris@39 29 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
Chris@39 30 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@39 31 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@39 32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@39 33 */
Chris@39 34
Chris@39 35 /*
Chris@39 36 * The text above constitutes the entire PortAudio license; however,
Chris@39 37 * the PortAudio community also makes the following non-binding requests:
Chris@39 38 *
Chris@39 39 * Any person wishing to distribute modifications to the Software is
Chris@39 40 * requested to send the modifications to the original developer so that
Chris@39 41 * they can be incorporated into the canonical version. It is also
Chris@39 42 * requested that these non-binding requests be included along with the
Chris@39 43 * license above.
Chris@39 44 */
Chris@39 45
Chris@39 46 #include <stdio.h>
Chris@39 47 #include <math.h>
Chris@39 48
Chris@39 49 #include "portaudio.h"
Chris@39 50
Chris@39 51 /*--------- Definitions ---------*/
Chris@39 52 #define MODE_INPUT (0)
Chris@39 53 #define MODE_OUTPUT (1)
Chris@39 54 #define FRAMES_PER_BUFFER (64)
Chris@39 55 #define SAMPLE_RATE (44100.0)
Chris@39 56
Chris@39 57 typedef struct PaQaData
Chris@39 58 {
Chris@39 59 unsigned long framesLeft;
Chris@39 60 int numChannels;
Chris@39 61 int bytesPerSample;
Chris@39 62 int mode;
Chris@39 63 }
Chris@39 64 PaQaData;
Chris@39 65
Chris@39 66 static int gNumPassed = 0; /* Two globals */
Chris@39 67 static int gNumFailed = 0;
Chris@39 68
Chris@39 69 /*------------------- Macros ------------------------------*/
Chris@39 70 /* Print ERROR if it fails. Tally success or failure. Odd */
Chris@39 71 /* do-while wrapper seems to be needed for some compilers. */
Chris@39 72
Chris@39 73 #define EXPECT(_exp) \
Chris@39 74 do \
Chris@39 75 { \
Chris@39 76 if ((_exp)) {\
Chris@39 77 gNumPassed++; \
Chris@39 78 } \
Chris@39 79 else { \
Chris@39 80 printf("\nERROR - 0x%x - %s for %s\n", result, Pa_GetErrorText(result), #_exp ); \
Chris@39 81 gNumFailed++; \
Chris@39 82 goto error; \
Chris@39 83 } \
Chris@39 84 } while(0)
Chris@39 85
Chris@39 86 #define HOPEFOR(_exp) \
Chris@39 87 do \
Chris@39 88 { \
Chris@39 89 if ((_exp)) {\
Chris@39 90 gNumPassed++; \
Chris@39 91 } \
Chris@39 92 else { \
Chris@39 93 printf("\nERROR - 0x%x - %s for %s\n", result, Pa_GetErrorText(result), #_exp ); \
Chris@39 94 gNumFailed++; \
Chris@39 95 } \
Chris@39 96 } while(0)
Chris@39 97
Chris@39 98 /*-------------------------------------------------------------------------*/
Chris@39 99 /* This routine will be called by the PortAudio engine when audio is needed.
Chris@39 100 It may be called at interrupt level on some machines so don't do anything
Chris@39 101 that could mess up the system like calling malloc() or free().
Chris@39 102 */
Chris@39 103 static int QaCallback( const void* inputBuffer,
Chris@39 104 void* outputBuffer,
Chris@39 105 unsigned long framesPerBuffer,
Chris@39 106 const PaStreamCallbackTimeInfo* timeInfo,
Chris@39 107 PaStreamCallbackFlags statusFlags,
Chris@39 108 void* userData )
Chris@39 109 {
Chris@39 110 unsigned long i;
Chris@39 111 unsigned char* out = (unsigned char *) outputBuffer;
Chris@39 112 PaQaData* data = (PaQaData *) userData;
Chris@39 113
Chris@39 114 (void)inputBuffer; /* Prevent "unused variable" warnings. */
Chris@39 115
Chris@39 116 /* Zero out buffer so we don't hear terrible noise. */
Chris@39 117 if( data->mode == MODE_OUTPUT )
Chris@39 118 {
Chris@39 119 unsigned long numBytes = framesPerBuffer * data->numChannels * data->bytesPerSample;
Chris@39 120 for( i=0; i<numBytes; i++ )
Chris@39 121 {
Chris@39 122 *out++ = 0;
Chris@39 123 }
Chris@39 124 }
Chris@39 125 /* Are we through yet? */
Chris@39 126 if( data->framesLeft > framesPerBuffer )
Chris@39 127 {
Chris@39 128 data->framesLeft -= framesPerBuffer;
Chris@39 129 return 0;
Chris@39 130 }
Chris@39 131 else
Chris@39 132 {
Chris@39 133 data->framesLeft = 0;
Chris@39 134 return 1;
Chris@39 135 }
Chris@39 136 }
Chris@39 137
Chris@39 138 static PaDeviceIndex FindInputOnlyDevice(void)
Chris@39 139 {
Chris@39 140 PaDeviceIndex result = Pa_GetDefaultInputDevice();
Chris@39 141 if( result != paNoDevice && Pa_GetDeviceInfo(result)->maxOutputChannels == 0 )
Chris@39 142 return result;
Chris@39 143
Chris@39 144 for( result = 0; result < Pa_GetDeviceCount(); ++result )
Chris@39 145 {
Chris@39 146 if( Pa_GetDeviceInfo(result)->maxOutputChannels == 0 )
Chris@39 147 return result;
Chris@39 148 }
Chris@39 149
Chris@39 150 return paNoDevice;
Chris@39 151 }
Chris@39 152
Chris@39 153 static PaDeviceIndex FindOutputOnlyDevice(void)
Chris@39 154 {
Chris@39 155 PaDeviceIndex result = Pa_GetDefaultOutputDevice();
Chris@39 156 if( result != paNoDevice && Pa_GetDeviceInfo(result)->maxInputChannels == 0 )
Chris@39 157 return result;
Chris@39 158
Chris@39 159 for( result = 0; result < Pa_GetDeviceCount(); ++result )
Chris@39 160 {
Chris@39 161 if( Pa_GetDeviceInfo(result)->maxInputChannels == 0 )
Chris@39 162 return result;
Chris@39 163 }
Chris@39 164
Chris@39 165 return paNoDevice;
Chris@39 166 }
Chris@39 167
Chris@39 168 /*-------------------------------------------------------------------------------------------------*/
Chris@39 169 static int TestBadOpens( void )
Chris@39 170 {
Chris@39 171 PaStream* stream = NULL;
Chris@39 172 PaError result;
Chris@39 173 PaQaData myData;
Chris@39 174 PaStreamParameters ipp, opp;
Chris@39 175 const PaDeviceInfo* info = NULL;
Chris@39 176
Chris@39 177
Chris@39 178 /* Setup data for synthesis thread. */
Chris@39 179 myData.framesLeft = (unsigned long) (SAMPLE_RATE * 100); /* 100 seconds */
Chris@39 180 myData.numChannels = 1;
Chris@39 181 myData.mode = MODE_OUTPUT;
Chris@39 182
Chris@39 183 /*----------------------------- No devices specified: */
Chris@39 184 ipp.device = opp.device = paNoDevice;
Chris@39 185 ipp.channelCount = opp.channelCount = 0; /* Also no channels. */
Chris@39 186 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 187 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 188 /* Take the low latency of the default device for all subsequent tests. */
Chris@39 189 info = Pa_GetDeviceInfo(Pa_GetDefaultInputDevice());
Chris@39 190 ipp.suggestedLatency = info ? info->defaultLowInputLatency : 0.100;
Chris@39 191 info = Pa_GetDeviceInfo(Pa_GetDefaultOutputDevice());
Chris@39 192 opp.suggestedLatency = info ? info->defaultLowOutputLatency : 0.100;
Chris@39 193 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@39 194 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 195 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 196
Chris@39 197 /*----------------------------- No devices specified #2: */
Chris@39 198 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, NULL,
Chris@39 199 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 200 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 201
Chris@39 202 /*----------------------------- Out of range input device specified: */
Chris@39 203 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 204 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 205 ipp.channelCount = 0; ipp.device = Pa_GetDeviceCount(); /* And no output device, and no channels. */
Chris@39 206 opp.channelCount = 0; opp.device = paNoDevice;
Chris@39 207 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@39 208 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 209 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 210
Chris@39 211 /*----------------------------- Out of range output device specified: */
Chris@39 212 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 213 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 214 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no channels. */
Chris@39 215 opp.channelCount = 0; opp.device = Pa_GetDeviceCount();
Chris@39 216 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 217 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 218 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 219
Chris@39 220 if (Pa_GetDefaultInputDevice() != paNoDevice) {
Chris@39 221 /*----------------------------- Zero input channels: */
Chris@39 222 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 223 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 224 ipp.channelCount = 0; ipp.device = Pa_GetDefaultInputDevice();
Chris@39 225 opp.channelCount = 0; opp.device = paNoDevice; /* And no output device, and no output channels. */
Chris@39 226 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@39 227 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 228 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@39 229 }
Chris@39 230
Chris@39 231 if (Pa_GetDefaultOutputDevice() != paNoDevice) {
Chris@39 232 /*----------------------------- Zero output channels: */
Chris@39 233 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 234 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 235 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no input channels. */
Chris@39 236 opp.channelCount = 0; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 237 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 238 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 239 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@39 240 }
Chris@39 241 /*----------------------------- Nonzero input and output channels but no output device: */
Chris@39 242 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 243 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 244 ipp.channelCount = 2; ipp.device = Pa_GetDefaultInputDevice(); /* Both stereo. */
Chris@39 245 opp.channelCount = 2; opp.device = paNoDevice;
Chris@39 246 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@39 247 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 248 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 249
Chris@39 250 /*----------------------------- Nonzero input and output channels but no input device: */
Chris@39 251 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 252 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 253 ipp.channelCount = 2; ipp.device = paNoDevice;
Chris@39 254 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 255 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@39 256 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 257 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@39 258
Chris@39 259 if (Pa_GetDefaultOutputDevice() != paNoDevice) {
Chris@39 260 /*----------------------------- NULL stream pointer: */
Chris@39 261 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 262 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 263 ipp.channelCount = 0; ipp.device = paNoDevice; /* Output is more likely than input. */
Chris@39 264 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice(); /* Only 2 output channels. */
Chris@39 265 HOPEFOR(((result = Pa_OpenStream(NULL, &ipp, &opp,
Chris@39 266 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 267 paClipOff, QaCallback, &myData )) == paBadStreamPtr));
Chris@39 268
Chris@39 269 /*----------------------------- Low sample rate: */
Chris@39 270 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 271 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 272 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@39 273 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 274 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 275 1.0, FRAMES_PER_BUFFER, /* 1 cycle per second (1 Hz) is too low. */
Chris@39 276 paClipOff, QaCallback, &myData )) == paInvalidSampleRate));
Chris@39 277
Chris@39 278 /*----------------------------- High sample rate: */
Chris@39 279 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 280 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 281 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@39 282 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 283 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 284 10000000.0, FRAMES_PER_BUFFER, /* 10^6 cycles per second (10 MHz) is too high. */
Chris@39 285 paClipOff, QaCallback, &myData )) == paInvalidSampleRate));
Chris@39 286
Chris@39 287 /*----------------------------- NULL callback: */
Chris@39 288 /* NULL callback is valid in V19 -- it means use blocking read/write stream
Chris@39 289
Chris@39 290 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 291 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 292 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@39 293 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 294 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 295 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 296 paClipOff,
Chris@39 297 NULL,
Chris@39 298 &myData )) == paNullCallback));
Chris@39 299 */
Chris@39 300
Chris@39 301 /*----------------------------- Bad flag: */
Chris@39 302 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 303 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 304 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@39 305 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@39 306 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 307 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 308 255, /* Is 8 maybe legal V19 API? */
Chris@39 309 QaCallback, &myData )) == paInvalidFlag));
Chris@39 310 }
Chris@39 311
Chris@39 312 /*----------------------------- using input device as output device: */
Chris@39 313 if( FindInputOnlyDevice() != paNoDevice )
Chris@39 314 {
Chris@39 315 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 316 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 317 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no channels. */
Chris@39 318 opp.channelCount = 2; opp.device = FindInputOnlyDevice();
Chris@39 319 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@39 320 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 321 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@39 322 }
Chris@39 323
Chris@39 324 /*----------------------------- using output device as input device: */
Chris@39 325 if( FindOutputOnlyDevice() != paNoDevice )
Chris@39 326 {
Chris@39 327 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@39 328 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@39 329 ipp.channelCount = 2; ipp.device = FindOutputOnlyDevice();
Chris@39 330 opp.channelCount = 0; opp.device = paNoDevice; /* And no output device, and no channels. */
Chris@39 331 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@39 332 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 333 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@39 334
Chris@39 335 }
Chris@39 336
Chris@39 337 if( stream != NULL ) Pa_CloseStream( stream );
Chris@39 338 return result;
Chris@39 339 }
Chris@39 340
Chris@39 341 /*-----------------------------------------------------------------------------------------*/
Chris@39 342 static int TestBadActions( void )
Chris@39 343 {
Chris@39 344 PaStream* stream = NULL;
Chris@39 345 const PaDeviceInfo* deviceInfo = NULL;
Chris@39 346 PaError result = 0;
Chris@39 347 PaQaData myData;
Chris@39 348 PaStreamParameters opp;
Chris@39 349 const PaDeviceInfo* info = NULL;
Chris@39 350
Chris@39 351 /* Setup data for synthesis thread. */
Chris@39 352 myData.framesLeft = (unsigned long)(SAMPLE_RATE * 100); /* 100 seconds */
Chris@39 353 myData.numChannels = 1;
Chris@39 354 myData.mode = MODE_OUTPUT;
Chris@39 355
Chris@39 356 opp.device = Pa_GetDefaultOutputDevice(); /* Default output. */
Chris@39 357 opp.channelCount = 2; /* Stereo output. */
Chris@39 358 opp.hostApiSpecificStreamInfo = NULL;
Chris@39 359 opp.sampleFormat = paFloat32;
Chris@39 360 info = Pa_GetDeviceInfo(opp.device);
Chris@39 361 opp.suggestedLatency = info ? info->defaultLowOutputLatency : 0.100;
Chris@39 362
Chris@39 363 if (opp.device != paNoDevice) {
Chris@39 364 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, /* Take NULL as input parame- */
Chris@39 365 &opp, /* ters, meaning try only output. */
Chris@39 366 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@39 367 paClipOff, QaCallback, &myData )) == paNoError));
Chris@39 368 }
Chris@39 369
Chris@39 370 HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(paNoDevice)) == NULL));
Chris@39 371 HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(87654)) == NULL));
Chris@39 372 HOPEFOR(((result = Pa_StartStream(NULL)) == paBadStreamPtr));
Chris@39 373 HOPEFOR(((result = Pa_StopStream(NULL)) == paBadStreamPtr));
Chris@39 374 HOPEFOR(((result = Pa_IsStreamStopped(NULL)) == paBadStreamPtr));
Chris@39 375 HOPEFOR(((result = Pa_IsStreamActive(NULL)) == paBadStreamPtr));
Chris@39 376 HOPEFOR(((result = Pa_CloseStream(NULL)) == paBadStreamPtr));
Chris@39 377 HOPEFOR(((result = Pa_SetStreamFinishedCallback(NULL, NULL)) == paBadStreamPtr));
Chris@39 378 HOPEFOR(((result = !Pa_GetStreamInfo(NULL))));
Chris@39 379 HOPEFOR(((result = Pa_GetStreamTime(NULL)) == 0.0));
Chris@39 380 HOPEFOR(((result = Pa_GetStreamCpuLoad(NULL)) == 0.0));
Chris@39 381 HOPEFOR(((result = Pa_ReadStream(NULL, NULL, 0)) == paBadStreamPtr));
Chris@39 382 HOPEFOR(((result = Pa_WriteStream(NULL, NULL, 0)) == paBadStreamPtr));
Chris@39 383
Chris@39 384 /** @todo test Pa_GetStreamReadAvailable and Pa_GetStreamWriteAvailable */
Chris@39 385
Chris@39 386 if (stream != NULL) Pa_CloseStream(stream);
Chris@39 387 return result;
Chris@39 388 }
Chris@39 389
Chris@39 390 /*---------------------------------------------------------------------*/
Chris@39 391 int main(void);
Chris@39 392 int main(void)
Chris@39 393 {
Chris@39 394 PaError result;
Chris@39 395
Chris@39 396 EXPECT(((result = Pa_Initialize()) == paNoError));
Chris@39 397 TestBadOpens();
Chris@39 398 TestBadActions();
Chris@39 399 error:
Chris@39 400 Pa_Terminate();
Chris@39 401 printf("QA Report: %d passed, %d failed.\n", gNumPassed, gNumFailed);
Chris@39 402 return 0;
Chris@39 403 }