int test_BR_LLSC_6_19_004(MYKI_BR_ContextData_t *pData) { CardImage_t CardImage; pData->InternalData.TransportMode = TRANSPORT_MODE_BUS; pData->DynamicData.lineId = 1; pData->DynamicData.stopId = 1; if ( CreateCardImage_Empty( &CardImage ) < 0 ) { return FALSE; } CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime + 60 ); // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.DateTime = pData->DynamicData.currentDateTime - 60; // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.EntryPointId = 0; // Don't care CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.RouteId = 0; // Don't care CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.StopId = 0; // Don't care CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.ProviderId = 2; // Non-rail CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Zone = 0; // Don't care CardImage.pMYKI_TAControl->ProductInUse = 1; return runTest( pData, RULE_RESULT_BYPASSED, 3 ); }
static void SetupStandardEnvironment_6_21( MYKI_BR_ContextData_t *pData, CardImage_t *pCardImage ) { pData->InternalData.TransportMode = TRANSPORT_MODE_BUS; pData->DynamicData.lineId = 1; pData->DynamicData.stopId = 1; pData->DynamicData.locationDataUnavailable = TRUE; pData->DynamicData.entryPointId = 123; pData->StaticData.serviceProviderId = ProviderId_BUS; if ( CreateCardImage_Empty( pCardImage ) < 0 ) // Sets product in use to (0) { return; } CreateProduct( pCardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime + 60 ); // Unexpired product of any type pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.DateTime = pData->DynamicData.currentDateTime - 60; // Don't care but make it sensible pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.Location.EntryPointId = 123; // Vehicle Id pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.Location.RouteId = 1; // Route pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.Location.StopId = 1; // Stop pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.ProviderId = ProviderId_BUS; // Bus provider pCardImage->pMYKI_TAProduct[ 0 ]->LastUsage.Zone = 0; // Don't care pCardImage->pMYKI_TAControl->ProductInUse = 1; pCardImage->pMYKI_TAControl->ProvisionalFare = 1; }
int test_BR_LLSC_6_19_005(MYKI_BR_ContextData_t *pData) { CardImage_t CardImage; int rv = TRUE; pData->InternalData.TransportMode = TRANSPORT_MODE_BUS; pData->DynamicData.lineId = 1; pData->DynamicData.stopId = 1; if ( CreateCardImage_Empty( &CardImage ) < 0 ) { return FALSE; } CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime + 60 ); // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.DateTime = pData->DynamicData.currentDateTime - 60; // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.EntryPointId = 10500; // Station ID CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.RouteId = 0; // Not set CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.StopId = 0; // Not set CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.ProviderId = 0; // Rail provider CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Zone = 0; // Don't care CardImage.pMYKI_TAControl->ProductInUse = 1; if ( ! runTest( pData, RULE_RESULT_EXECUTED, 0 ) ) { return FALSE; } if ( pData->DynamicData.fareRouteIdIsValid != FALSE ) { CsVerbose("test_BR_LLSC_6_19 - fareRouteIdIsValid NOT false as expected" ); rv = FALSE; } if ( pData->DynamicData.isEarlyBirdTrip != FALSE ) { CsVerbose("test_BR_LLSC_6_19 - isEarlyBirdTrip NOT false as expected" ); rv = FALSE; } if ( pData->DynamicData.transportLocationsCount != 2 ) { CsVerbose("test_BR_LLSC_6_19 - transportLocationsCount NOT (2) as expected" ); rv = FALSE; } if ( pData->DynamicData.currentTripDirection != TRIP_DIRECTION_INBOUND ) { CsVerbose("test_BR_LLSC_6_19 - currentTripDirection NOT inbound as expected" ); rv = FALSE; } return rv; }
int main(){ Entrepot ptrUnEntrepot; entrepot unEntrepot; char unNom[50] = "\0"; produit monProduit; int i; printf("Nom de mon entrepot :\n"); scanf("%s",unNom); unEntrepot = CreateWarehouse(unNom); ptrUnEntrepot = &unEntrepot; printf("%s\n",ptrUnEntrepot->nomMagasin); for(i=1;i<6;i++) { printf("Nom de mon produit %d:\n",i); scanf("%s", monProduit.nom); monProduit.id = i; monProduit.prix = 12; monProduit.stock = 100; CreateProduct(ptrUnEntrepot,monProduit); } /*for(i=0;i< 500;i++) { if(ptrUnEntrepot->Produit[i].id != 0) { printf("Nom Produit : %s\n",ptrUnEntrepot->Produit[i].nom); printf(" Stock : %d\n",ptrUnEntrepot->Produit[i].stock); } }*/ PrintWarehouse(ptrUnEntrepot); StockAll("StockTotal.txt", unEntrepot); ChangeStockProduct(ptrUnEntrepot,3,-90); ChangeStockProduct(ptrUnEntrepot,5,-80); ChangeStockProduct(ptrUnEntrepot,1,-78); PrintWarehouse(ptrUnEntrepot); printf("Nombre de produit dont le stock est inférieur a 25 : %d\n",StockBas(ptrUnEntrepot,25)); return 0; }
Product* Creator::GetProduct () { if (_product == 0) { _product = CreateProduct(); } return _product; }
int test_BR_LLSC_6_20_010(MYKI_BR_ContextData_t *pData) { int rv = TRUE; CardImage_t CardImage; /* ** Test with */ if (CreateCardImage_Empty(&CardImage) < 0) { return FALSE; } CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime ); CardImage.pMYKI_TAControl->ProductInUse = 1; /* ** Setup Transport locations ** Not a Border Trip */ pData->DynamicData.transportLocationsCount = 3; pData->DynamicData.transportLocations[0].inner_zone = 3; pData->DynamicData.transportLocations[0].zone = 3; pData->DynamicData.transportLocations[0].outer_zone = 4; pData->DynamicData.transportLocations[1].inner_zone = 4; pData->DynamicData.transportLocations[1].zone = 4; pData->DynamicData.transportLocations[1].outer_zone = 5; pData->DynamicData.transportLocations[2].inner_zone = 5; pData->DynamicData.transportLocations[2].zone = 6; pData->DynamicData.transportLocations[2].outer_zone = 6; /* ** Run the Test and examine the results */ if (!runTest(pData, RULE_RESULT_EXECUTED, 302)) { return FALSE; } /* ** Examine conditions */ if (pData->DynamicData.transportLocationsCount) { CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" ); rv = FALSE; } if (pData->DynamicData.currentTripZoneLow != 4) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow ); rv = FALSE; } if (pData->DynamicData.currentTripZoneHigh != 5) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh ); rv = FALSE; } return rv; }
int test_BR_LLSC_6_20_009(MYKI_BR_ContextData_t *pData) { int rv = TRUE; CardImage_t CardImage; MYKI_CD_DifferentialPricing_t differentialPricing; /* ** Test with */ if (CreateCardImage_Empty(&CardImage) < 0) { return FALSE; } CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime ); CardImage.pMYKI_TAControl->ProductInUse = 1; /* ** Setup Transport locations ** Not a Border Trip */ pData->DynamicData.transportLocationsCount = 2; pData->DynamicData.transportLocations[0].inner_zone = 3; pData->DynamicData.transportLocations[0].zone = 3; pData->DynamicData.transportLocations[0].outer_zone = 4; pData->DynamicData.transportLocations[1].inner_zone = 4; pData->DynamicData.transportLocations[1].zone = 4; pData->DynamicData.transportLocations[1].outer_zone = 5; /* ** Setup a Differential Price to be processed by the Rule */ differentialPricing.discount_type = MYKI_CD_DISCOUNT_TYPE_PERCENT; differentialPricing.applied_discount = 33; strcpy(differentialPricing.short_desc,"Test 008"); MYKI_CD_setDifferentialPriceStructure(&differentialPricing); /* ** Run the Test and examine the results */ if (!runTest(pData, RULE_RESULT_EXECUTED, 202)) { return FALSE; } /* ** Examine conditions */ if (pData->DynamicData.transportLocationsCount) { CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" ); rv = FALSE; } if (pData->DynamicData.currentTripZoneLow != 4) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow ); rv = FALSE; } if (pData->DynamicData.currentTripZoneHigh != 4) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh ); rv = FALSE; } if (pData->DynamicData.offPeakDiscountRate != 33) { CsVerbose("test_BR_LLSC_6_20 - offPeakDiscountRate NOT as expected" ); rv = FALSE; } if (pData->DynamicData.isOffPeak != TRUE) { CsVerbose("test_BR_LLSC_6_20 - isOffPeak NOT as expected" ); rv = FALSE; } return rv; }
int test_BR_LLSC_6_20_008(MYKI_BR_ContextData_t *pData) { int rv = TRUE; CardImage_t CardImage; pData->InternalData.TransportMode = TRANSPORT_MODE_BUS; pData->DynamicData.lineId = 1; pData->DynamicData.stopId = 1; /* ** Test with */ if ( CreateCardImage_Empty( &CardImage ) < 0 ) { return FALSE; } CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime + 60 ); // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.DateTime = pData->DynamicData.currentDateTime - 60; // Don't care but make it sensible CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.EntryPointId = 10500; // Station ID CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.RouteId = 0; // Not set CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.StopId = 0; // Not set CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.ProviderId = 0; // Rail provider CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Zone = 0; // Don't care CardImage.pMYKI_TAControl->ProductInUse = 1; /* ** Setup Transport locations ** Not a Border Trip */ pData->DynamicData.transportLocationsCount = 2; pData->DynamicData.transportLocations[0].inner_zone = 3; pData->DynamicData.transportLocations[0].zone = 3; pData->DynamicData.transportLocations[0].outer_zone = 4; pData->DynamicData.transportLocations[1].inner_zone = 4; pData->DynamicData.transportLocations[1].zone = 4; pData->DynamicData.transportLocations[1].outer_zone = 5; /* ** Forced Scan Off not set (testing scan-on/off modes of transport instead) */ pData->DynamicData.isForcedScanOff = FALSE; /* ** Run the Test and examine the results */ if (!runTest(pData, RULE_RESULT_EXECUTED, 102)) { return FALSE; } /* ** Examine conditions */ if (pData->DynamicData.transportLocationsCount) { CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" ); rv = FALSE; } if (pData->DynamicData.currentTripZoneLow != 4) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow ); rv = FALSE; } if (pData->DynamicData.currentTripZoneHigh != 4) { CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh ); rv = FALSE; } return rv; }