1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393 |
- /* Generated by YAKINDU Statechart Tools code generator. */
- #include <algorithm>
- #include <list>
- #include "gtest/gtest.h"
- #include "Operations.h"
- #include "OperationsRequired.h"
- #include "sc_timer_service.h"
- class InternalOperation1Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void internalOperation1() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static InternalOperation1Mock* internalOperation1Mock;
- class InternalOperation2Mock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<InternalOperation2Mock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void InternalOperation2(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static InternalOperation2Mock* internalOperation2Mock;
- class InternalOperation3Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void internalOperation3() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static InternalOperation3Mock* internalOperation3Mock;
- class InternalOperation3aMock{
- struct parameters {
- sc_real param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<InternalOperation3aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void internalOperation3a(const sc_real param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static InternalOperation3aMock* internalOperation3aMock;
- class InternalOperation4Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void internalOperation4() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static InternalOperation4Mock* internalOperation4Mock;
- class InternalOperation4aMock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<InternalOperation4aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void internalOperation4a(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static InternalOperation4aMock* internalOperation4aMock;
- class InternalOperation5Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void internalOperation5() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static InternalOperation5Mock* internalOperation5Mock;
- class InternalOperation5aMock{
- struct parameters {
- const sc_string param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<InternalOperation5aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void internalOperation5a(const sc_string param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<InternalOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static InternalOperation5aMock* internalOperation5aMock;
- class Interface1InterfaceOperation1Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void interfaceOperation1() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static Interface1InterfaceOperation1Mock* interface1InterfaceOperation1Mock;
- class Interface1InterfaceOperation2Mock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<Interface1InterfaceOperation2Mock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void InterfaceOperation2(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static Interface1InterfaceOperation2Mock* interface1InterfaceOperation2Mock;
- class Interface1InterfaceOperation3Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void interfaceOperation3() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static Interface1InterfaceOperation3Mock* interface1InterfaceOperation3Mock;
- class Interface1InterfaceOperation3aMock{
- struct parameters {
- sc_real param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<Interface1InterfaceOperation3aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void interfaceOperation3a(const sc_real param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static Interface1InterfaceOperation3aMock* interface1InterfaceOperation3aMock;
- class Interface1InterfaceOperation4Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void interfaceOperation4() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static Interface1InterfaceOperation4Mock* interface1InterfaceOperation4Mock;
- class Interface1InterfaceOperation4aMock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<Interface1InterfaceOperation4aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void interfaceOperation4a(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static Interface1InterfaceOperation4aMock* interface1InterfaceOperation4aMock;
- class Interface1InterfaceOperation5Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void interfaceOperation5() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static Interface1InterfaceOperation5Mock* interface1InterfaceOperation5Mock;
- class Interface1InterfaceOperation5aMock{
- struct parameters {
- const sc_string param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<Interface1InterfaceOperation5aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void interfaceOperation5a(const sc_string param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<Interface1InterfaceOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static Interface1InterfaceOperation5aMock* interface1InterfaceOperation5aMock;
- class UnnamedInterfaceOperation1Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void unnamedInterfaceOperation1() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static UnnamedInterfaceOperation1Mock* unnamedInterfaceOperation1Mock;
- class UnnamedInterfaceOperation2Mock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<UnnamedInterfaceOperation2Mock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedInterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedInterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void UnnamedInterfaceOperation2(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedInterfaceOperation2Mock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static UnnamedInterfaceOperation2Mock* unnamedInterfaceOperation2Mock;
- class UnnamedOperation3Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void unnamedOperation3() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static UnnamedOperation3Mock* unnamedOperation3Mock;
- class UnnamedOperation3aMock{
- struct parameters {
- sc_real param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<UnnamedOperation3aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_real param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void unnamedOperation3a(const sc_real param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation3aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static UnnamedOperation3aMock* unnamedOperation3aMock;
- class UnnamedOperation4Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void unnamedOperation4() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static UnnamedOperation4Mock* unnamedOperation4Mock;
- class UnnamedOperation4aMock{
- struct parameters {
- sc_integer param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<UnnamedOperation4aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_integer param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void unnamedOperation4a(const sc_integer param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation4aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static UnnamedOperation4aMock* unnamedOperation4aMock;
- class UnnamedOperation5Mock{
- public:
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- void unnamedOperation5() {
- callCount++;
- }
- void reset() {
- callCount = 0;
- }
- };
- static UnnamedOperation5Mock* unnamedOperation5Mock;
- class UnnamedOperation5aMock{
- struct parameters {
- const sc_string param1;
- int callCount;
- inline bool operator==(const parameters& other) {
- return (this->param1 == other.param1);
- }
- };
- public:
- std::list<UnnamedOperation5aMock::parameters> paramCount;
- int callCount;
- sc_boolean calledAtLeast(const int times){
- return (callCount >= times);
- }
-
- sc_boolean calledAtLeastOnce(){
- return (callCount>0);
- }
- sc_boolean calledAtLeast(const int times, const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount >= times);
- }else{
- return false;
- }
- }
-
- sc_boolean calledAtLeastOnce(const sc_string param1){
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- return (i->callCount > 0);
- }else{
- return false;
- }
- }
- void unnamedOperation5a(const sc_string param1) {
- callCount++;
-
- parameters p;
- p.param1 = param1;
-
- std::list<UnnamedOperation5aMock::parameters>::iterator i = std::find(paramCount.begin(), paramCount.end(), p);
- if(i != paramCount.end()) {
- p.callCount = (i->callCount + 1);
- paramCount.erase(i);
-
- }else{
- p.callCount = 1;
- }
- paramCount.push_back(p);
- }
- void reset() {
- callCount = 0;
- paramCount.clear();
- }
- };
- static UnnamedOperation5aMock* unnamedOperation5aMock;
- class AlwaysTrueMock{
- typedef sc_boolean (AlwaysTrueMock::*functiontype)();
- public:
- sc_boolean (AlwaysTrueMock::*alwaysTrueBehaviorDefault)();
- sc_boolean alwaysTrue1(){
- return (true);
- }
- sc_boolean alwaysTrueDefault(){
- return (false);
- }
- functiontype getBehavior(){
- return alwaysTrueBehaviorDefault;
- }
-
- void setDefaultBehavior(sc_boolean (AlwaysTrueMock::*defaultBehavior)()){
- alwaysTrueBehaviorDefault = defaultBehavior;
- }
-
- void initializeBehavior() {
- setDefaultBehavior(&AlwaysTrueMock::alwaysTrueDefault);
- }
-
- void reset() {
- initializeBehavior();
- }
- };
- static AlwaysTrueMock* alwaysTrueMock;
- //! The timers are managed by a timer service. */
- static sc_unit_timer_service_t timer_service;
- static Operations statechart;
- class OperationsTest : public ::testing::Test{
- protected:
- virtual void SetUp() {
- operations_init(&statechart);
- sc_timer_service_init(
- &timer_service,
- 0,
- (sc_run_cycle_fp) &operations_runCycle,
- false,
- 200,
- &statechart
- );
- }
- };
- TEST_F(OperationsTest, operationsCalled) {
- alwaysTrueMock = new AlwaysTrueMock();
- alwaysTrueMock->initializeBehavior();
- internalOperation1Mock = new InternalOperation1Mock();
- internalOperation2Mock = new InternalOperation2Mock();
- internalOperation3Mock = new InternalOperation3Mock();
- internalOperation3aMock = new InternalOperation3aMock();
- internalOperation4Mock = new InternalOperation4Mock();
- internalOperation4aMock = new InternalOperation4aMock();
- internalOperation5Mock = new InternalOperation5Mock();
- internalOperation5aMock = new InternalOperation5aMock();
- interface1InterfaceOperation1Mock = new Interface1InterfaceOperation1Mock();
- interface1InterfaceOperation2Mock = new Interface1InterfaceOperation2Mock();
- interface1InterfaceOperation3Mock = new Interface1InterfaceOperation3Mock();
- interface1InterfaceOperation3aMock = new Interface1InterfaceOperation3aMock();
- interface1InterfaceOperation4Mock = new Interface1InterfaceOperation4Mock();
- interface1InterfaceOperation4aMock = new Interface1InterfaceOperation4aMock();
- interface1InterfaceOperation5Mock = new Interface1InterfaceOperation5Mock();
- interface1InterfaceOperation5aMock = new Interface1InterfaceOperation5aMock();
- unnamedInterfaceOperation1Mock = new UnnamedInterfaceOperation1Mock();
- unnamedInterfaceOperation2Mock = new UnnamedInterfaceOperation2Mock();
- unnamedOperation3Mock = new UnnamedOperation3Mock();
- unnamedOperation3aMock = new UnnamedOperation3aMock();
- unnamedOperation4Mock = new UnnamedOperation4Mock();
- unnamedOperation4aMock = new UnnamedOperation4aMock();
- unnamedOperation5Mock = new UnnamedOperation5Mock();
- unnamedOperation5aMock = new UnnamedOperation5aMock();
- alwaysTrueMock->setDefaultBehavior(&AlwaysTrueMock::alwaysTrue1);
- operations_enter(&statechart);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_A));
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_B));
- EXPECT_TRUE(internalOperation1Mock->calledAtLeastOnce());
- EXPECT_TRUE(internalOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_TRUE(internalOperation3Mock->calledAtLeastOnce());
- EXPECT_TRUE(internalOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_TRUE(internalOperation4Mock->calledAtLeastOnce());
- EXPECT_TRUE(internalOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_TRUE(internalOperation5Mock->calledAtLeastOnce());
- EXPECT_TRUE(internalOperation5aMock->calledAtLeastOnce());
- operationsIface_raise_ev(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_C));
- EXPECT_TRUE(interface1InterfaceOperation1Mock->calledAtLeastOnce());
- EXPECT_TRUE(interface1InterfaceOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_TRUE(interface1InterfaceOperation3Mock->calledAtLeastOnce());
- EXPECT_TRUE(interface1InterfaceOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_TRUE(interface1InterfaceOperation4Mock->calledAtLeastOnce());
- EXPECT_TRUE(interface1InterfaceOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_TRUE(interface1InterfaceOperation5Mock->calledAtLeastOnce());
- EXPECT_TRUE(interface1InterfaceOperation5aMock->calledAtLeastOnce());
- operationsIface_raise_ev(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_D));
- EXPECT_TRUE(unnamedInterfaceOperation1Mock->calledAtLeastOnce());
- EXPECT_TRUE(unnamedInterfaceOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_TRUE(unnamedOperation3Mock->calledAtLeastOnce());
- EXPECT_TRUE(unnamedOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_TRUE(unnamedOperation4Mock->calledAtLeastOnce());
- EXPECT_TRUE(unnamedOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_TRUE(unnamedOperation5Mock->calledAtLeastOnce());
- EXPECT_TRUE(unnamedOperation5aMock->calledAtLeastOnce());
- alwaysTrueMock->reset();
- internalOperation1Mock->reset();
- internalOperation2Mock->reset();
- internalOperation3Mock->reset();
- internalOperation3aMock->reset();
- internalOperation4Mock->reset();
- internalOperation4aMock->reset();
- internalOperation5Mock->reset();
- internalOperation5aMock->reset();
- interface1InterfaceOperation1Mock->reset();
- interface1InterfaceOperation2Mock->reset();
- interface1InterfaceOperation3Mock->reset();
- interface1InterfaceOperation3aMock->reset();
- interface1InterfaceOperation4Mock->reset();
- interface1InterfaceOperation4aMock->reset();
- interface1InterfaceOperation5Mock->reset();
- interface1InterfaceOperation5aMock->reset();
- unnamedInterfaceOperation1Mock->reset();
- unnamedInterfaceOperation2Mock->reset();
- unnamedOperation3Mock->reset();
- unnamedOperation3aMock->reset();
- unnamedOperation4Mock->reset();
- unnamedOperation4aMock->reset();
- unnamedOperation5Mock->reset();
- unnamedOperation5aMock->reset();
- }
- TEST_F(OperationsTest, operationsNotCalled) {
- alwaysTrueMock = new AlwaysTrueMock();
- alwaysTrueMock->initializeBehavior();
- internalOperation1Mock = new InternalOperation1Mock();
- internalOperation2Mock = new InternalOperation2Mock();
- internalOperation3Mock = new InternalOperation3Mock();
- internalOperation3aMock = new InternalOperation3aMock();
- internalOperation4Mock = new InternalOperation4Mock();
- internalOperation4aMock = new InternalOperation4aMock();
- internalOperation5Mock = new InternalOperation5Mock();
- internalOperation5aMock = new InternalOperation5aMock();
- interface1InterfaceOperation1Mock = new Interface1InterfaceOperation1Mock();
- interface1InterfaceOperation2Mock = new Interface1InterfaceOperation2Mock();
- interface1InterfaceOperation3Mock = new Interface1InterfaceOperation3Mock();
- interface1InterfaceOperation3aMock = new Interface1InterfaceOperation3aMock();
- interface1InterfaceOperation4Mock = new Interface1InterfaceOperation4Mock();
- interface1InterfaceOperation4aMock = new Interface1InterfaceOperation4aMock();
- interface1InterfaceOperation5Mock = new Interface1InterfaceOperation5Mock();
- interface1InterfaceOperation5aMock = new Interface1InterfaceOperation5aMock();
- unnamedInterfaceOperation1Mock = new UnnamedInterfaceOperation1Mock();
- unnamedInterfaceOperation2Mock = new UnnamedInterfaceOperation2Mock();
- unnamedOperation3Mock = new UnnamedOperation3Mock();
- unnamedOperation3aMock = new UnnamedOperation3aMock();
- unnamedOperation4Mock = new UnnamedOperation4Mock();
- unnamedOperation4aMock = new UnnamedOperation4aMock();
- unnamedOperation5Mock = new UnnamedOperation5Mock();
- unnamedOperation5aMock = new UnnamedOperation5aMock();
- alwaysTrueMock->setDefaultBehavior(&AlwaysTrueMock::alwaysTrue1);
- operations_enter(&statechart);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_A));
- EXPECT_FALSE(internalOperation1Mock->calledAtLeastOnce());
- EXPECT_FALSE(internalOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_FALSE(internalOperation3Mock->calledAtLeastOnce());
- EXPECT_FALSE(internalOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_FALSE(internalOperation4Mock->calledAtLeastOnce());
- EXPECT_FALSE(internalOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_FALSE(internalOperation5Mock->calledAtLeastOnce());
- EXPECT_FALSE(internalOperation5aMock->calledAtLeastOnce());
- operationsIface_raise_ev(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_B));
- EXPECT_FALSE(interface1InterfaceOperation1Mock->calledAtLeastOnce());
- EXPECT_FALSE(interface1InterfaceOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_FALSE(interface1InterfaceOperation3Mock->calledAtLeastOnce());
- EXPECT_FALSE(interface1InterfaceOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_FALSE(interface1InterfaceOperation4Mock->calledAtLeastOnce());
- EXPECT_FALSE(interface1InterfaceOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_FALSE(interface1InterfaceOperation5Mock->calledAtLeastOnce());
- EXPECT_FALSE(interface1InterfaceOperation5aMock->calledAtLeastOnce());
- operationsIface_raise_ev(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(operations_isStateActive(&statechart, Operations_main_region_C));
- EXPECT_FALSE(unnamedInterfaceOperation1Mock->calledAtLeastOnce());
- EXPECT_FALSE(unnamedInterfaceOperation2Mock->calledAtLeastOnce(4l));
- EXPECT_FALSE(unnamedOperation3Mock->calledAtLeastOnce());
- EXPECT_FALSE(unnamedOperation3aMock->calledAtLeastOnce(1.0));
- EXPECT_FALSE(unnamedOperation4Mock->calledAtLeastOnce());
- EXPECT_FALSE(unnamedOperation4aMock->calledAtLeastOnce(5l));
- EXPECT_FALSE(unnamedOperation5Mock->calledAtLeastOnce());
- EXPECT_FALSE(unnamedOperation5aMock->calledAtLeastOnce());
- alwaysTrueMock->reset();
- internalOperation1Mock->reset();
- internalOperation2Mock->reset();
- internalOperation3Mock->reset();
- internalOperation3aMock->reset();
- internalOperation4Mock->reset();
- internalOperation4aMock->reset();
- internalOperation5Mock->reset();
- internalOperation5aMock->reset();
- interface1InterfaceOperation1Mock->reset();
- interface1InterfaceOperation2Mock->reset();
- interface1InterfaceOperation3Mock->reset();
- interface1InterfaceOperation3aMock->reset();
- interface1InterfaceOperation4Mock->reset();
- interface1InterfaceOperation4aMock->reset();
- interface1InterfaceOperation5Mock->reset();
- interface1InterfaceOperation5aMock->reset();
- unnamedInterfaceOperation1Mock->reset();
- unnamedInterfaceOperation2Mock->reset();
- unnamedOperation3Mock->reset();
- unnamedOperation3aMock->reset();
- unnamedOperation4Mock->reset();
- unnamedOperation4aMock->reset();
- unnamedOperation5Mock->reset();
- unnamedOperation5aMock->reset();
- }
- void operationsInternal_internalOperation1(const Operations* statechart){
- internalOperation1Mock->internalOperation1();
- }
- sc_boolean operationsInternal_internalOperation2(const Operations* statechart, const sc_integer param1){
- internalOperation2Mock->InternalOperation2(param1);
- return false;
- }
- sc_real operationsInternal_internalOperation3(const Operations* statechart){
- internalOperation3Mock->internalOperation3();
- return 0.0d;
- }
- sc_real operationsInternal_internalOperation3a(const Operations* statechart, const sc_real param1){
- internalOperation3aMock->internalOperation3a(param1);
- return 0.0d;
- }
- sc_integer operationsInternal_internalOperation4(const Operations* statechart){
- internalOperation4Mock->internalOperation4();
- return 0;
- }
- sc_integer operationsInternal_internalOperation4a(const Operations* statechart, const sc_integer param1){
- internalOperation4aMock->internalOperation4a(param1);
- return 0;
- }
- sc_string operationsInternal_internalOperation5(const Operations* statechart){
- internalOperation5Mock->internalOperation5();
- return 0;
- }
- sc_string operationsInternal_internalOperation5a(const Operations* statechart, const sc_string param1){
- internalOperation5aMock->internalOperation5a(param1);
- return 0;
- }
- void operationsIfaceInterface1_interfaceOperation1(const Operations* statechart){
- interface1InterfaceOperation1Mock->interfaceOperation1();
- }
- sc_boolean operationsIfaceInterface1_interfaceOperation2(const Operations* statechart, const sc_integer param1){
- interface1InterfaceOperation2Mock->InterfaceOperation2(param1);
- return false;
- }
- sc_real operationsIfaceInterface1_interfaceOperation3(const Operations* statechart){
- interface1InterfaceOperation3Mock->interfaceOperation3();
- return 0.0d;
- }
- sc_real operationsIfaceInterface1_interfaceOperation3a(const Operations* statechart, const sc_real param1){
- interface1InterfaceOperation3aMock->interfaceOperation3a(param1);
- return 0.0d;
- }
- sc_integer operationsIfaceInterface1_interfaceOperation4(const Operations* statechart){
- interface1InterfaceOperation4Mock->interfaceOperation4();
- return 0;
- }
- sc_integer operationsIfaceInterface1_interfaceOperation4a(const Operations* statechart, const sc_integer param1){
- interface1InterfaceOperation4aMock->interfaceOperation4a(param1);
- return 0;
- }
- sc_string operationsIfaceInterface1_interfaceOperation5(const Operations* statechart){
- interface1InterfaceOperation5Mock->interfaceOperation5();
- return 0;
- }
- sc_string operationsIfaceInterface1_interfaceOperation5a(const Operations* statechart, const sc_string param1){
- interface1InterfaceOperation5aMock->interfaceOperation5a(param1);
- return 0;
- }
- void operationsIface_unnamedInterfaceOperation1(const Operations* statechart){
- unnamedInterfaceOperation1Mock->unnamedInterfaceOperation1();
- }
- sc_boolean operationsIface_unnamedInterfaceOperation2(const Operations* statechart, const sc_integer param1){
- unnamedInterfaceOperation2Mock->UnnamedInterfaceOperation2(param1);
- return false;
- }
- sc_real operationsIface_unnamedOperation3(const Operations* statechart){
- unnamedOperation3Mock->unnamedOperation3();
- return 0.0d;
- }
- sc_real operationsIface_unnamedOperation3a(const Operations* statechart, const sc_real param1){
- unnamedOperation3aMock->unnamedOperation3a(param1);
- return 0.0d;
- }
- sc_integer operationsIface_unnamedOperation4(const Operations* statechart){
- unnamedOperation4Mock->unnamedOperation4();
- return 0;
- }
- sc_integer operationsIface_unnamedOperation4a(const Operations* statechart, const sc_integer param1){
- unnamedOperation4aMock->unnamedOperation4a(param1);
- return 0;
- }
- sc_string operationsIface_unnamedOperation5(const Operations* statechart){
- unnamedOperation5Mock->unnamedOperation5();
- return 0;
- }
- sc_string operationsIface_unnamedOperation5a(const Operations* statechart, const sc_string param1){
- unnamedOperation5aMock->unnamedOperation5a(param1);
- return 0;
- }
- sc_boolean operationsIface_alwaysTrue(const Operations* statechart){
- return (alwaysTrueMock->*(alwaysTrueMock->getBehavior()))();
- }
|