コード例 #1
0
ファイル: Test.cpp プロジェクト: PeterSommerlad/EH_Tutorial
void testNumber1234(){
	std::ostringstream out;
	printLargeNumber(1234,1,out);
	ASSERT_EQUAL("    -  -    \n"
			     "  |  |  || |\n"
			     "    -  -  - \n"
			     "  ||    |  |\n"
			     "    -  -    \n",out.str());
}
コード例 #2
0
void pocketcalculator(std::istream &in){
	std::string inputstring;
	std::getline(in, inputstring);

	std::istringstream inpstrstream{inputstring};
	int result=calc(inpstrstream);

	std::ostringstream out{};
	printLargeNumber(result, out);
}
コード例 #3
0
ファイル: Test.cpp プロジェクト: lukasmartinelli/retrocalc
void printErrorPrintsErrorSymbol() {
	//Arrange
	std::ostringstream out {};
	const int number { -1 };
	//Act
	printLargeNumber(number, out);
	//Assert
	std::string expected = {
		"      \n"
		"     |\n"
		" -    \n"
		"     |\n"
		"      \n"
	};
	ASSERT_EQUAL(expected, out.str());
}
コード例 #4
0
ファイル: Test.cpp プロジェクト: lukasmartinelli/retrocalc
void printLargeNumberCanPrintZero() {
	//Arrange
	std::ostringstream out {};
	unsigned int number { 0 };
	//Act
	printLargeNumber(number, out);
	//Assert
	std::string expected = {
		" - \n"
		"| |\n"
		"   \n"
		"| |\n"
		" - \n"
	};
	ASSERT_EQUAL(expected, out.str());
}
コード例 #5
0
ファイル: Test.cpp プロジェクト: lukasmartinelli/retrocalc
void printLargeNumberRendersMultipleDigits() {
	//Arrange
	std::ostringstream out {};
	unsigned int number { 319 };
	//Act
	printLargeNumber(number, out);
	//Assert
	std::string expected = {
		" -     - \n"
		"  |  || |\n"
		" -     - \n"
		"  |  |  |\n"
		" -     - \n"
	};
	ASSERT_EQUAL(expected, out.str());
}