@@ -330,6 +330,8 @@ int main(int argc, char** argv)
330330 ssTEST_OUTPUT_SETUP
331331 (
332332 std::vector<std::shared_ptr<OverrideResult>> initializeResults (4 , nullptr );
333+
334+ // NOTE: This initializes the mapping for the first 2 scripts in scriptsPaths
333335 prepareInitialization ( initializeResults.at (0 ), initializeResults.at (1 ),
334336 initializeResults.at (2 ), initializeResults.at (3 ), " " );
335337 CO_SETUP_OVERRIDE (OverrideInstance, Mock_exists)
@@ -352,7 +354,7 @@ int main(int argc, char** argv)
352354 // Hash script path
353355 std::shared_ptr<OverrideResult> hashResult = CreateOverrideResult ();
354356 CO_SETUP_OVERRIDE (OverrideInstance, operator ())
355- .WhenCalledWith <std::string>(scriptsPaths.at (2 ))
357+ .WhenCalledWith <std::string>(scriptsPaths.at (2 ) + " 0 " )
356358 .Returns <std::size_t >(15 )
357359 .Times (1 )
358360 .AssignResult (hashResult);
@@ -386,6 +388,9 @@ int main(int argc, char** argv)
386388 ssTEST_OUTPUT_ASSERT ( " New mapping exists" ,
387389 BuildsManagerAccessor ::GetMappings (*buildsManager)
388390 .count (scriptsPaths.at (2 )) == 1 );
391+ ssTEST_OUTPUT_ASSERT ( " New mapping value is correct" ,
392+ BuildsManagerAccessor ::GetMappings (*buildsManager)
393+ .at (scriptsPaths.at (2 )) == scriptsBuildsPaths.at (2 ));
389394 };
390395
391396 ssTEST (" CreateBuildMapping Should Create Build Mapping When Hashed Output Is Not Unique" )
@@ -394,17 +399,17 @@ int main(int argc, char** argv)
394399 commonInitializeBuildsManager ();
395400 ssTEST_OUTPUT_SETUP
396401 (
397- // Hash script path not unique
402+ // Hash script path not unique (first attempt)
398403 std::shared_ptr<OverrideResult> hashNotUniqueResult = CreateOverrideResult ();
399404 CO_SETUP_OVERRIDE (OverrideInstance, operator ())
400- .WhenCalledWith (scriptsPaths.at (2 ))
405+ .WhenCalledWith (scriptsPaths.at (2 ) + " 0 " )
401406 .Returns <std::size_t >(10 )
402407 .Times (1 )
403408 .AssignResult (hashNotUniqueResult);
404- // Hash script path unique
409+ // Hash script path unique (second attempt)
405410 std::shared_ptr<OverrideResult> hashUniqueResult = CreateOverrideResult ();
406411 CO_SETUP_OVERRIDE (OverrideInstance, operator ())
407- .WhenCalledWith (scriptsPaths.at (2 ))
412+ .WhenCalledWith (scriptsPaths.at (2 ) + " 1 " )
408413 .Returns <std::size_t >(15 )
409414 .Times (1 )
410415 .AssignResult (hashUniqueResult);
@@ -419,13 +424,16 @@ int main(int argc, char** argv)
419424 );
420425 ssTEST_OUTPUT_ASSERT ( " CreateBuildMapping should succeed" ,
421426 buildsManager->CreateBuildMapping (scriptsPaths.at (2 )), true );
422- ssTEST_OUTPUT_ASSERT ( " Hash script path not unique" ,
427+ ssTEST_OUTPUT_ASSERT ( " Hash script path not unique (first attempt) " ,
423428 hashNotUniqueResult->GetSucceedCount () == 1 );
424- ssTEST_OUTPUT_ASSERT ( " Hash script path unique" ,
429+ ssTEST_OUTPUT_ASSERT ( " Hash script path unique (second attempt) " ,
425430 hashUniqueResult->LastStatusSucceed ());
426431 ssTEST_OUTPUT_ASSERT ( " New mapping exists" ,
427432 BuildsManagerAccessor ::GetMappings (*buildsManager)
428433 .count (scriptsPaths.at (2 )) == 1 );
434+ ssTEST_OUTPUT_ASSERT ( " New mapping value is correct" ,
435+ BuildsManagerAccessor ::GetMappings (*buildsManager)
436+ .at (scriptsPaths.at (2 )) == scriptsBuildsPaths.at (2 ));
429437 };
430438
431439 ssTEST (" CreateBuildMapping Should Return True When Mapping For Script Exists" )
@@ -630,3 +638,4 @@ int main(int argc, char** argv)
630638}
631639
632640
641+
0 commit comments