Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal authored and vishal committed Jul 25, 2024
1 parent 4e5e405 commit 2ff4dd5
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions apps/boilerplate-generator/src/FullBoilerPlateParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ export class FullBoilerPlateParser {
const inputReads = this.inputFields
.map((field, index) => {
if (field.type.startsWith("list<")) {
return `int size_${field.name};\n std::istringstream(lines[${index}]) >> size_${field.name};\n ${this.mapTypeToCpp(field.type)} ${field.name}(size_${field.name});\n if(!size_${field.name}==0) {\n \tstd::istringstream iss(lines[${index + 1}]);\n \tfor (int i=0; i < size_arr; i++) iss >> arr[i];\n }`;
return `int size_${field.name};\n std::istringstream(lines[${index}]) >> size_${field.name};\n ${this.mapTypeToCpp(field.type)} ${field.name}(size_${field.name});\n if(size_${field.name} != 0) {\n \tstd::istringstream iss(lines[${index + 1}]);\n \tfor (int i=0; i < size_${field.name}; i++) iss >> ${field.name}[i];\n }`;
} else {
return `${this.mapTypeToCpp(field.type)} ${field.name};\n std::istringstream(lines[${index}]) >> ${field.name};`;
}
})
.join("\n ");
const outputType = this.outputFields[0].type;
const functionCall = `${outputType} result = ${this.functionName}(${this.inputFields.map((field) => field.name).join(", ")});`;
const functionCall = `std::${outputType} result = ${this.functionName}(${this.inputFields.map((field) => field.name).join(", ")});`;
const outputWrite = `std::cout << result << std::endl;`;

return `#include <iostream>
Expand Down
6 changes: 3 additions & 3 deletions apps/problems/Broken-SubArray/boilerplate-full/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
int size_A;
std::istringstream(lines[0]) >> size_A;
std::vector<int> A(size_A);
if(!size_A==0) {
if(size_A != 0) {
std::istringstream iss(lines[1]);
for (int i=0; i < size_arr; i++) iss >> arr[i];
for (int i=0; i < size_A; i++) iss >> A[i];
}
int B;
std::istringstream(lines[1]) >> B;
int result = solve(A, B);
std::int result = solve(A, B);
std::cout << result << std::endl;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file.close();
int n;
std::istringstream(lines[0]) >> n;
int result = calculateFibonacci(n);
std::int result = calculateFibonacci(n);
std::cout << result << std::endl;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file.close();
std::string text;
std::istringstream(lines[0]) >> text;
bool result = isPalindrome(text);
std::bool result = isPalindrome(text);
std::cout << result << std::endl;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file.close();
float celsius;
std::istringstream(lines[0]) >> celsius;
float result = celsiusToFahrenheit(celsius);
std::float result = celsiusToFahrenheit(celsius);
std::cout << result << std::endl;
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/problems/Find-Median/boilerplate-full/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
int size_numbers;
std::istringstream(lines[0]) >> size_numbers;
std::vector<int> numbers(size_numbers);
if(!size_numbers==0) {
if(size_numbers != 0) {
std::istringstream iss(lines[1]);
for (int i=0; i < size_arr; i++) iss >> arr[i];
for (int i=0; i < size_numbers; i++) iss >> numbers[i];
}
float result = findMedian(numbers);
std::float result = findMedian(numbers);
std::cout << result << std::endl;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file.close();
int limit;
std::istringstream(lines[0]) >> limit;
list<int> result = findPrimes(limit);
std::list<int> result = findPrimes(limit);
std::cout << result << std::endl;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/problems/Intersting-Arrays/tests/inputs/2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
2
1 2
4
2 4 8 16
4 changes: 2 additions & 2 deletions apps/problems/Intersting-Arrays/tests/inputs/3.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3
3 5 6
4
3 6 9 12
2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/inputs/5.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
7
23 89 23 89 23 89 23
23 9 23 89 2 89 21
2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/outputs/1.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
No
Yes
2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/outputs/2.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
No
No
2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/outputs/4.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Yes
No
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

file.close();

list<int> result = mergeSortedArrays();
std::list<int> result = mergeSortedArrays();
std::cout << result << std::endl;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/problems/Reverse-String/boilerplate-full/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file.close();
std::string originalString;
std::istringstream(lines[0]) >> originalString;
string result = reverseString(originalString);
std::string result = reverseString(originalString);
std::cout << result << std::endl;
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/problems/Sort-Array/boilerplate-full/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
int size_values;
std::istringstream(lines[0]) >> size_values;
std::vector<int> values(size_values);
if(!size_values==0) {
if(size_values != 0) {
std::istringstream iss(lines[1]);
for (int i=0; i < size_arr; i++) iss >> arr[i];
for (int i=0; i < size_values; i++) iss >> values[i];
}
list<int> result = sortArray(values);
std::list<int> result = sortArray(values);
std::cout << result << std::endl;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/problems/max-element/boilerplate-full/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
int size_arr;
std::istringstream(lines[0]) >> size_arr;
std::vector<int> arr(size_arr);
if(!size_arr==0) {
if(size_arr != 0) {
std::istringstream iss(lines[1]);
for (int i=0; i < size_arr; i++) iss >> arr[i];
}
int result = maxElement(arr);
std::int result = maxElement(arr);
std::cout << result << std::endl;
return 0;
}
Expand Down

0 comments on commit 2ff4dd5

Please sign in to comment.