Skip to content
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e17e048
3: red
dariatdd Oct 17, 2018
c767b0d
3: green
dariatdd Oct 17, 2018
632fc27
3: refactored
dariatdd Oct 17, 2018
bfd3651
3: red
dariatdd Oct 17, 2018
f3e6397
3: green
dariatdd Oct 17, 2018
786f2b5
3: refactored
dariatdd Oct 17, 2018
baa87b2
3: red
dariatdd Oct 17, 2018
b9cf145
3: green
dariatdd Oct 17, 2018
690a9f4
3: red
dariatdd Oct 17, 2018
fd275a4
3: green
dariatdd Oct 17, 2018
0e6fd67
3: red
dariatdd Oct 18, 2018
f5b7a58
3: green
dariatdd Oct 18, 2018
a0f24de
3: refactored
dariatdd Oct 18, 2018
2ddf4e4
3: red
dariatdd Oct 18, 2018
ddcf27e
3: green
dariatdd Oct 18, 2018
f6ac1c8
3: red
dariatdd Oct 18, 2018
f8e9ede
3: green
dariatdd Oct 18, 2018
1ed7c30
3: red
dariatdd Oct 18, 2018
57fdb9d
3: green
dariatdd Oct 18, 2018
358a7a6
3: refactored
dariatdd Oct 18, 2018
542610d
3: red
dariatdd Oct 18, 2018
71e37c7
3: green
dariatdd Oct 18, 2018
91b0c9a
3: red
dariatdd Oct 18, 2018
9aaa010
3: green
dariatdd Oct 18, 2018
81700f1
3: red
dariatdd Oct 18, 2018
50f5ff1
3: green
dariatdd Oct 18, 2018
6a50a76
3: red
dariatdd Oct 18, 2018
a794f4f
3: green
dariatdd Oct 18, 2018
c3b5eb7
3: refactored
dariatdd Oct 18, 2018
6f6c48c
3: red
dariatdd Oct 18, 2018
e02de92
3: green
dariatdd Oct 18, 2018
71dfdce
3: red
dariatdd Oct 18, 2018
eefd203
3: green
dariatdd Oct 18, 2018
f5a2664
3: added tests on GetDigit
dariatdd Oct 18, 2018
a1ba32f
3: red
dariatdd Oct 18, 2018
04d4de2
3: green
dariatdd Oct 18, 2018
14ef94c
3: added accesptance tests on ConvertDisplay
dariatdd Oct 18, 2018
c511584
3: refactored
dariatdd Oct 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 102 additions & 97 deletions tdd_intro/homework/03_bank_ocr/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,110 +91,110 @@ const unsigned short g_digitLen = 3;
const unsigned short g_linesInDigit = 3;
struct Digit
{
std::string lines[g_linesInDigit];
std::vector<std::string> lines;
};

const unsigned short g_digitsOnDisplay = 9;
struct Display
{
std::string lines[g_linesInDigit];
std::vector<std::string> lines;
};

const Digit s_digit0 = { " _ ",
"| |",
"|_|"
};
const Digit s_digit1 = { " ",
" |",
" |"
};
const Digit s_digit2 = { " _ ",
" _|",
"|_ "
};
const Digit s_digit3 = { " _ ",
" _|",
" _|"
};
const Digit s_digit4 = { " ",
"|_|",
" |"
};
const Digit s_digit5 = { " _ ",
"|_ ",
" _|"
};
const Digit s_digit6 = { " _ ",
"|_ ",
"|_|"
};
const Digit s_digit7 = { " _ ",
" |",
" |"
};
const Digit s_digit8 = { " _ ",
"|_|",
"|_|"
};
const Digit s_digit9 = { " _ ",
"|_|",
" _|"
};

const Display s_displayAll0 = { " _ _ _ _ _ _ _ _ _ ",
"| || || || || || || || || |",
"|_||_||_||_||_||_||_||_||_|"
};

const Display s_displayAll1 = { " ",
" | | | | | | | | |",
" | | | | | | | | |"
};

const Display s_displayAll2 = { " _ _ _ _ _ _ _ _ _ ",
const Digit s_digit0 = {{ " _ ",
"| |",
"|_|"
}};
const Digit s_digit1 = {{ " ",
" |",
" |"
}};
const Digit s_digit2 = {{ " _ ",
" _|",
"|_ "
}};
const Digit s_digit3 = {{ " _ ",
" _|",
" _|"
}};
const Digit s_digit4 = {{ " ",
"|_|",
" |"
}};
const Digit s_digit5 = {{ " _ ",
"|_ ",
" _|"
}};
const Digit s_digit6 = {{ " _ ",
"|_ ",
"|_|"
}};
const Digit s_digit7 = {{ " _ ",
" |",
" |"
}};
const Digit s_digit8 = {{ " _ ",
"|_|",
"|_|"
}};
const Digit s_digit9 = {{ " _ ",
"|_|",
" _|"
}};

const Display s_displayAll0 = {{ " _ _ _ _ _ _ _ _ _ ",
"| || || || || || || || || |",
"|_||_||_||_||_||_||_||_||_|"
}};

const Display s_displayAll1 = {{ " ",
" | | | | | | | | |",
" | | | | | | | | |"
}};

const Display s_displayAll2 = {{ " _ _ _ _ _ _ _ _ _ ",
" _| _| _| _| _| _| _| _| _|",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ "
}};

const Display s_displayAll3 = {{ " _ _ _ _ _ _ _ _ _ ",
" _| _| _| _| _| _| _| _| _|",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ "
};

const Display s_displayAll3 = { " _ _ _ _ _ _ _ _ _ ",
" _| _| _| _| _| _| _| _| _|",
" _| _| _| _| _| _| _| _| _|"
};

const Display s_displayAll4 = { " ",
"|_||_||_||_||_||_||_||_||_|",
" | | | | | | | | |"
};

const Display s_displayAll5 = { " _ _ _ _ _ _ _ _ _ ",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ ",
" _| _| _| _| _| _| _| _| _|"
};

const Display s_displayAll6 = { " _ _ _ _ _ _ _ _ _ ",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ ",
"|_||_||_||_||_||_||_||_||_|"
};

const Display s_displayAll7 = { " _ _ _ _ _ _ _ _ _ ",
" | | | | | | | | |",
" | | | | | | | | |"
};

const Display s_displayAll8 = { " _ _ _ _ _ _ _ _ _ ",
"|_||_||_||_||_||_||_||_||_|",
"|_||_||_||_||_||_||_||_||_|"
};

const Display s_displayAll9 = { " _ _ _ _ _ _ _ _ _ ",
"|_||_||_||_||_||_||_||_||_|",
" _| _| _| _| _| _| _| _| _|"
};

const Display s_display123456789 = { " _ _ _ _ _ _ _ ",
" | _| _||_||_ |_ ||_||_|",
" ||_ _| | _||_| ||_| _|"
};
" _| _| _| _| _| _| _| _| _|"
}};

const Display s_displayAll4 = {{ " ",
"|_||_||_||_||_||_||_||_||_|",
" | | | | | | | | |"
}};

const Display s_displayAll5 = {{ " _ _ _ _ _ _ _ _ _ ",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ ",
" _| _| _| _| _| _| _| _| _|"
}};

const Display s_displayAll6 = {{ " _ _ _ _ _ _ _ _ _ ",
"|_ |_ |_ |_ |_ |_ |_ |_ |_ ",
"|_||_||_||_||_||_||_||_||_|"
}};

const Display s_displayAll7 = {{ " _ _ _ _ _ _ _ _ _ ",
" | | | | | | | | |",
" | | | | | | | | |"
}};

const Display s_displayAll8 = {{ " _ _ _ _ _ _ _ _ _ ",
"|_||_||_||_||_||_||_||_||_|",
"|_||_||_||_||_||_||_||_||_|"
}};

const Display s_displayAll9 = {{ " _ _ _ _ _ _ _ _ _ ",
"|_||_||_||_||_||_||_||_||_|",
" _| _| _| _| _| _| _| _| _|"
}};

const Display s_display123456789 = {{ " _ _ _ _ _ _ _ ",
" | _| _||_||_ |_ ||_||_|",
" ||_ _| | _||_| ||_| _|"
}};

bool CheckDigitLine(const std::string& line, const std::string& lineToCompare)
{
Expand All @@ -208,7 +208,11 @@ bool CheckDigitLine(const std::string& line, const std::string& lineToCompare)

unsigned short ConvertDigit(const Digit& digit)
{
throw std::exception("Invalid format");
if(digit.lines.empty())
{
throw std::exception("Invalid format");
}
return -1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет теста

}

TEST(CheckDigitLine, EmptyString)
Expand Down Expand Up @@ -236,3 +240,4 @@ TEST(ConvertDigit, EmptyDigit)
Digit g;
EXPECT_THROW(ConvertDigit(g), std::exception);
}