SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdbool.h> | |
| 2 | #include <stdio.h> | |
| 3 | #include <string.h> | |
| 4 | - | bool substituirVogaisPorEspaco(char *string){
|
| 4 | + | |
| 5 | - | char vogais[]="aeiouAEIOU"; |
| 5 | + | |
| 6 | - | bool substituiu = false; |
| 6 | + | |
| 7 | bool testSubstituirVogaisPorEspaco(void){
| |
| 8 | - | for( int i=0; i<strlen(string); i++){
|
| 8 | + | char *string ="abcdef"; |
| 9 | - | for( int j=0; j<strlen(vogais); j++){
|
| 9 | + | char *resultadoEsperado = " bcd f"; |
| 10 | - | if(string[i] == vogais[j]){
|
| 10 | + | |
| 11 | - | string[i] = ' '; |
| 11 | + | substituirVogaisPorEspaco(string); // string = "AbcdEf" |
| 12 | - | substituiu = true; |
| 12 | + | |
| 13 | - | } |
| 13 | + | if( !strcmp( resultadoEsperado, string) ){
|
| 14 | - | } |
| 14 | + | printf("Erro no teste da funcao substituirVogaisPorEspaco\n");
|
| 15 | return false; | |
| 16 | } | |
| 17 | - | return substituiu; |
| 17 | + | return true; |
| 18 | } | |
| 19 | ||
| 20 | - | bool substituirNumerosPorLetras(char *string){
|
| 20 | + |