Skip to content

Commit 5d4385a

Browse files
committed
update tests
1 parent 5a1efed commit 5d4385a

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "petya_and_vasya_labyrinth.hpp"
22

33
int main() {
4-
ComplicatedBadSolution();
4+
// ComplicatedBadSolution();
55
GoodSolution();
66
return 0;
77
}

additional_tasks/petya_and_vasya_labyrinth/src/test.cpp

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,20 @@ TEST(ComplicatedBadSolutionTest, PetyaWins) {
331331
<< "#000#000#0#\n"
332332
<< "#0###0#####\n\n";
333333

334+
auto maze = ss.str();
335+
334336
std::stringstream output;
335337

336338
ComplicatedBadSolution(ss, output);
337339
EXPECT_EQ(output.str(), "Petya! with 6\n");
338340

341+
ss << maze;
342+
343+
std::stringstream output_12;
344+
345+
GoodSolution(ss, output_12);
346+
EXPECT_EQ(output_12.str(), "Petya! with 6\n");
347+
339348
std::stringstream ss_2;
340349
ss_2 << "#########V##\n"
341350
<< "#000000#000#\n"
@@ -349,10 +358,19 @@ TEST(ComplicatedBadSolutionTest, PetyaWins) {
349358
<< "#00000000000\n"
350359
<< "##P#########\n\n";
351360

361+
maze = ss_2.str();
362+
352363
std::stringstream output_2;
353364

354365
ComplicatedBadSolution(ss_2, output_2);
355366
EXPECT_EQ(output_2.str(), "Petya! with 8\n");
367+
368+
ss_2 << maze;
369+
370+
std::stringstream output_22;
371+
372+
GoodSolution(ss_2, output_22);
373+
EXPECT_EQ(output_22.str(), "Petya! with 8\n");
356374
}
357375

358376
TEST(ComplicatedBadSolutionTest, VasyaWins) {
@@ -369,11 +387,20 @@ TEST(ComplicatedBadSolutionTest, VasyaWins) {
369387
<< "#000#000#0#\n"
370388
<< "#####0#####\n\n";
371389

390+
auto maze = ss.str();
391+
372392
std::stringstream output;
373393

374394
ComplicatedBadSolution(ss, output);
375395
EXPECT_EQ(output.str(), "Vasya! with 21\n");
376396

397+
ss << maze;
398+
399+
std::stringstream output_12;
400+
401+
GoodSolution(ss, output_12);
402+
EXPECT_EQ(output_12.str(), "Vasya! with 21\n");
403+
377404
std::stringstream ss_2;
378405
ss_2 << "###V#########\n"
379406
<< "#00000000#00#\n"
@@ -387,13 +414,22 @@ TEST(ComplicatedBadSolutionTest, VasyaWins) {
387414
<< "#0000#000000#\n"
388415
<< "####0##P#####\n\n";
389416

417+
maze = ss_2.str();
418+
390419
std::stringstream output_2;
391420

392421
ComplicatedBadSolution(ss_2, output_2);
393422
EXPECT_EQ(output_2.str(), "Vasya! with 6\n");
423+
424+
ss_2 << maze;
425+
426+
std::stringstream output_22;
427+
428+
GoodSolution(ss_2, output_22);
429+
EXPECT_EQ(output_22.str(), "Vasya! with 6\n");
394430
}
395431

396-
TEST(ComplicatedBadSolutionTest, PetyaWinsHard) {
432+
TEST(ComplicatedBadSolutionTest, PetyaWinsHardDAGRelaxation) {
397433
std::stringstream ss;
398434
ss << "###V###\n"
399435
<< "#00000#\n"
@@ -411,6 +447,24 @@ TEST(ComplicatedBadSolutionTest, PetyaWinsHard) {
411447
EXPECT_EQ(output.str(), "Petya! with 6\n");
412448
}
413449

450+
TEST(ComplicatedBadSolutionTest, PetyaWinsHardAStar) {
451+
std::stringstream ss;
452+
ss << "###V###\n"
453+
<< "#00000#\n"
454+
<< "#00000#\n"
455+
<< "#00000#\n"
456+
<< "#000000\n"
457+
<< "#00000#\n"
458+
<< "#00000#\n"
459+
<< "#00000#\n"
460+
<< "####P##\n\n";
461+
462+
std::stringstream output;
463+
464+
GoodSolution(ss, output);
465+
EXPECT_EQ(output.str(), "Petya! with 6\n");
466+
}
467+
414468
TEST(ComplicatedBadSolutionTest, Draw) {
415469
std::stringstream ss;
416470
ss << "##V########\n"
@@ -425,10 +479,19 @@ TEST(ComplicatedBadSolutionTest, Draw) {
425479
<< "#000#000#0#\n"
426480
<< "###########\n\n";
427481

482+
auto maze = ss.str();
483+
428484
std::stringstream output;
429485

430486
ComplicatedBadSolution(ss, output);
431487
EXPECT_EQ(output.str(), "Draw! with 25\n");
488+
489+
ss << maze;
490+
491+
std::stringstream output_12;
492+
493+
GoodSolution(ss, output_12);
494+
EXPECT_EQ(output_12.str(), "Draw! with 25\n");
432495
}
433496

434497
TEST(ComplicatedBadSolutionTest, ValeryWins) {
@@ -445,8 +508,17 @@ TEST(ComplicatedBadSolutionTest, ValeryWins) {
445508
<< "#000#000#0#\n"
446509
<< "###########\n\n";
447510

511+
auto maze = ss.str();
512+
448513
std::stringstream output;
449514

450515
ComplicatedBadSolution(ss, output);
451516
EXPECT_EQ(output.str(), "Deadlock! Valery!\n");
517+
518+
ss << maze;
519+
520+
std::stringstream output_12;
521+
522+
GoodSolution(ss, output_12);
523+
EXPECT_EQ(output_12.str(), "Deadlock! Valery!\n");
452524
}

0 commit comments

Comments
 (0)