Fixed bug in toBin function

This commit is contained in:
2021-06-29 12:00:12 -04:00
parent 5e3c4bd004
commit 16b2a6f792
2 changed files with 14 additions and 6 deletions

View File

@@ -553,21 +553,29 @@ bool testToBin(){
}
//Test 2
uint64_t num2 = 8;
correctAnswer = "1000";
answer = mee::toBin(num2);
num = 0;
correctAnswer = "0";
answer = mee::toBin(num);
if(correctAnswer != answer){
return false;
}
//Test 3
num = 0;
correctAnswer = "0";
num = 1000000;
correctAnswer = "11110100001001000000";
answer = mee::toBin(num);
if(correctAnswer != answer){
return false;
}
//Test 4
uint64_t num2 = 8;
correctAnswer = "1000";
answer = mee::toBin(num2);
if(correctAnswer != answer){
return false;
}
//If it hasn't failed a test then return true for passing all the tests
return true;
}