home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-19 | 11.7 KB | 594 lines | [TEXT/MPS ] |
- /*
- File: SITestClasses.cp
-
- Contains: Test code for SI-type classes
-
- Copyright: © 1992-1994 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #define qDebug 1
-
- #include <GlobalNew.h>
- #include "SITestClasses.h"
-
- #ifndef __LIBRARYMANAGERUTILITIES__
- #include <LibraryManagerUtilities.h>
- #endif
-
- static unsigned short gState;
-
- /*******************************************************************************
- ** InitTestLibrary
- ********************************************************************************/
-
- void InitTestLibrary()
- {
- gState = 0;
- }
-
- unsigned short GetStateValue()
- {
- return gState;
- }
-
- /*******************************************************************************
- ** Class TNVTest1
- ********************************************************************************/
-
- #define knv1state1 0
- #define knv1state2 4
-
- TNVTest1::TNVTest1()
- {
- fField = gState++;
- if (fField != knv1state1 && fField != knv1state2)
- DebugBreak("TNVTest1::TNVTest1 - state not right");
- }
-
- TNVTest1::~TNVTest1()
- {
- switch (fField)
- {
- case knv1state1:
- if (gState++ != fField + 3)
- DebugBreak("TNVTest1::~TNVTest1 - gState not correct");
- break;
-
- case knv1state2:
- if (gState++ != fField + 7)
- DebugBreak("TNVTest1::~TNVTest1 - gState not correct");
- break;
-
- default:
- gState += 1;
- DebugBreak("TNVTest1::~TNVTest1 - fField not correct");
- }
- }
-
-
- int TNVTest1::NVTest1(int a, int b)
- {
- switch (fField)
- {
- case knv1state1:
- if (a != 1 || b != 2)
- DebugBreak("TNVTest1::NVTest1 - arguments incorrect");
- if (gState++ != fField + 1)
- DebugBreak("TNVTest1::NVTest1 - gState not right");
- break;
-
- case knv1state2:
- if (a != 5 || b != 6)
- DebugBreak("TNVTest1::NVTest1 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TNVTest1::NVTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TNVTest1::NVTest1 - fField not right");
- }
- return a + b;
- }
-
- int TNVTest1::NVTest2(int a, int b)
- {
- switch (fField)
- {
- case knv1state1:
- if (a != 3 || b != 4)
- DebugBreak("TNVTest1::NVTest2 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TNVTest1::NVTest2 - gState not right");
- break;
-
- case knv1state2:
- if (a != 7 || b != 8)
- DebugBreak("TNVTest1::NVTest2 - arguments incorrect");
- if (gState++ != fField + 3)
- DebugBreak("TNVTest1::NVTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TNVTest1::NVTest1 - fField not right");
- }
- return a - b;
- }
-
- /*******************************************************************************
- ** Class TNVTest2
- ********************************************************************************/
-
- #define knv2state 5
-
- TNVTest2::TNVTest2()
- {
- fField2 = gState++;
- if (fField2 != knv2state)
- DebugBreak("TNVTest2::TNVTest2 - state not right");
- }
-
- TNVTest2::~TNVTest2()
- {
- if (fField2 != knv2state)
- DebugBreak("TNVTest2::~TNVTest2 - fField2 not right");
- if (gState++ != fField2 + 5)
- DebugBreak("TNVTest2::~TNVTest2 - state not right");
- }
-
-
- int TNVTest2::NVTest3(int a, int b)
- {
- if (gState++ != knv2state + 3)
- DebugBreak("TNVTest2::NVTest3 - state not right");
- if (fField2 != knv2state)
- DebugBreak("TNVTest2::NVTest3 - fField2 not right");
- return a + b;
- }
-
- int TNVTest2::NVTest4(int a, int b)
- {
- if (gState++ != knv2state + 4)
- DebugBreak("TNVTest2::NVTest4 - state not right");
- if (fField2 != knv2state)
- DebugBreak("TNVTest2::NVTest4 - fField2 not right");
- return a + b;
- }
-
- /*******************************************************************************
- ** Class TSITest1
- ********************************************************************************/
-
- #define ksi1state1 12
-
- TSITest1::TSITest1()
- {
- fField = gState++;
- if (fField != ksi1state1)
- DebugBreak("TSITest1::TSITest1 - state not right");
- }
-
- TSITest1::~TSITest1()
- {
- switch (fField)
- {
- case ksi1state1:
- if (gState++ != fField + 5)
- DebugBreak("TSITest1::~TSITest1 - gState not correct");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest1::~TSITest1 - fField not correct");
- break;
- }
- }
-
- int TSITest1::VTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi1state1:
- if (a != 13 || b != 14)
- DebugBreak("TSITest1::VTest1 - arguments incorrect");
- if (gState++ != fField + 1)
- DebugBreak("TSITest1::VTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest1::VTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest1::VTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi1state1:
- if (a != 15 || b != 16)
- DebugBreak("TSITest1::VTest2 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TSITest1::VTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest1::VTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- int TSITest1::NVTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi1state1:
- if (a != 17 || b != 18)
- DebugBreak("TSITest1::NVTest1 - arguments incorrect");
- if (gState++ != fField + 3)
- DebugBreak("TSITest1::NVTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest1::NVTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest1::NVTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi1state1:
- if (a != 19 || b != 20)
- DebugBreak("TSITest1::NVTest2 - arguments incorrect");
- if (gState++ != fField + 4)
- DebugBreak("TSITest1::NVTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest1::NVTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- /*******************************************************************************
- ** Class TSITest2
- ********************************************************************************/
-
- #define ksi2state1 18
-
- ASLM_SCDECLARATION(TSITest2);
-
- TSITest2::TSITest2()
- {
- fField = gState++;
- if (fField != ksi2state1)
- DebugBreak("TSITest2::TSITest2 - state not right");
- }
-
- TSITest2::~TSITest2()
- {
- switch (fField)
- {
- case ksi2state1:
- if (gState++ != fField + 5)
- DebugBreak("TSITest2::~TSITest2 - gState not correct");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest2::~TSITest2 - fField not correct");
- break;
- }
- }
-
- int TSITest2::VTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi2state1:
- if (a != 21 || b != 22)
- DebugBreak("TSITest2::VTest1 - arguments incorrect");
- if (gState++ != fField + 1)
- DebugBreak("TSITest2::VTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest2::VTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest2::VTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi2state1:
- if (a != 23 || b != 24)
- DebugBreak("TSITest2::VTest2 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TSITest2::VTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest2::VTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- int TSITest2::NVTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi2state1:
- if (a != 25 || b != 26)
- DebugBreak("TSITest2::NVTest1 - arguments incorrect");
- if (gState++ != fField + 3)
- DebugBreak("TSITest2::NVTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest2::NVTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest2::NVTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi2state1:
- if (a != 27 || b != 28)
- DebugBreak("TSITest2::NVTest2 - arguments incorrect");
- if (gState++ != fField + 4)
- DebugBreak("TSITest2::NVTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest2::NVTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- /*******************************************************************************
- ** Class TSITest3
- ********************************************************************************/
-
- #define ksi3state1 24
- #define ksi3state2 30
-
- ASLM_SCDECLARATION(TSITest3);
-
- TSITest3::TSITest3()
- {
- fField = gState++;
- if (fField != ksi3state1 && fField != ksi3state2)
- DebugBreak("TSITest3::TSITest3 - state not right");
- }
-
- TSITest3::~TSITest3()
- {
- switch (fField)
- {
- case ksi3state1:
- if (gState++ != fField + 5)
- DebugBreak("TSITest3::~TSITest3 - gState not correct");
- break;
-
- case ksi3state2:
- if (gState++ != fField + 5)
- DebugBreak("TSITest3::~TSITest3 - gState not correct");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest3::~TSITest3 - fField not correct");
- break;
- }
- }
-
- int TSITest3::VTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi3state1:
- if (a != 29 || b != 30)
- DebugBreak("TSITest3::VTest1 - arguments incorrect");
- if (gState++ != fField + 1)
- DebugBreak("TSITest3::VTest1 - gState not right");
- break;
-
- case ksi3state2:
- if (a != 37 || b != 38)
- DebugBreak("TSITest3::VTest1 - arguments incorrect");
- if (gState++ != fField + 1)
- DebugBreak("TSITest3::VTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest3::VTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest3::VTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi3state1:
- if (a != 31 || b != 32)
- DebugBreak("TSITest3::VTest2 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TSITest3::VTest2 - gState not right");
- break;
-
- case ksi3state2:
- if (a != 39 || b != 40)
- DebugBreak("TSITest3::VTest1 - arguments incorrect");
- if (gState++ != fField + 2)
- DebugBreak("TSITest3::VTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest3::VTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- int TSITest3::NVTest1(int a, int b)
- {
- switch (fField)
- {
- case ksi3state1:
- if (a != 33 || b != 34)
- DebugBreak("TSITest3::NVTest1 - arguments incorrect");
- if (gState++ != fField + 3)
- DebugBreak("TSITest3::NVTest1 - gState not right");
- break;
-
- case ksi3state2:
- if (a != 41 || b != 42)
- DebugBreak("TSITest3::NVTest1 - arguments incorrect");
- if (gState++ != fField + 3)
- DebugBreak("TSITest3::NVTest1 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest3::NVTest1 - fField not right");
- break;
- }
- return a + b;
- }
-
- int TSITest3::NVTest2(int a, int b)
- {
- switch (fField)
- {
- case ksi3state1:
- if (a != 35 || b != 36)
- DebugBreak("TSITest3::NVTest2 - arguments incorrect");
- if (gState++ != fField + 4)
- DebugBreak("TSITest3::NVTest2 - gState not right");
- break;
-
- case ksi3state2:
- if (a != 43 || b != 44)
- DebugBreak("TSITest3::NVTest2 - arguments incorrect");
- if (gState++ != fField + 4)
- DebugBreak("TSITest3::NVTest2 - gState not right");
- break;
-
- default:
- gState += 1;
- DebugBreak("TSITest3::NVTest2 - fField not right");
- break;
- }
- return a - b;
- }
-
- /*******************************************************************************
- ** Class TSITest4
- ********************************************************************************/
-
- ASLM_SCDECLARATION(TSITest4);
-
- TSITest4::TSITest4()
- {
- fField = 0;
- }
-
- TSITest4::~TSITest4()
- {}
-
- int TSITest4::VTest1(int a, int b)
- {
- return a + b;
- }
-
- int TSITest4::VTest2(int a, int b)
- {
- return a - b;
- }
-
- int TSITest4::VTest3(int a, int b)
- {
- return a + b;
- }
-
- int TSITest4::VTest4(int a, int b)
- {
- return a - b;
- }
-
- int TSITest4::NVTest1(int a, int b)
- {
- return a + b;
- }
-
- int TSITest4::NVTest2(int a, int b)
- {
- return a - b;
- }
-
- /*******************************************************************************
- ** Class TSITest5
- ********************************************************************************/
-
- TSITest5::TSITest5()
- {
- fField2 = 0;
- }
-
- TSITest5::~TSITest5()
- {}
-
- int TSITest5::VTest1(int a, int b)
- {
- return a - b;
- }
-
- int TSITest5::VTest2(int a, int b)
- {
- return a + b;
- }
-
- int TSITest5::VTest4(int a, int b)
- {
- return a - b;
- }
-
- int TSITest5::NVTest1(int a, int b)
- {
- return a + b;
- }
-
- int TSITest5::NVTest2(int a, int b)
- {
- return a - b;
- }
-
-