Giter VIP home page Giter VIP logo

megasenha's Introduction

Megasenha

Program made to modular programming class (PS - Programacao Sistematica).

megasenha's People

Contributors

tpimentelms avatar isaqb avatar tmkobayashi avatar douglasbraga94 avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar

megasenha's Issues

teste_armazenamento

include <time.h>

include <stdio.h>

include <stdlib.h>

include <string.h>

include "CUnit/CUnit.h"

include "CUnit/Basic.h"

include "modulo_armazenamento.c"

include "interface_palavra_e_dicas.h"

//Tests to verify if the functions are assigning values to the address that is passed
void test_VerifygetWordFirstRoundisWorking(void){
wordAndHints newWordAndHint;
wordAndHints newWordAndHint2;
FILE *file;
file = fopen("dicas_primeira_fase.txt","r");
primeira_fase(file, &(newWordAndHint));
CU_ASSERT_NOT_EQUAL(newWordAndHint.word , newWordAndHint2.word);
}

void test_VerifygetWordSecondRoundEasyisWorking(void){
wordAndHints newWordAndHint;
wordAndHints newWordAndHint2;
FILE *file;
file = fopen("dicas_primeira_fase.txt","r");
segunda_fase_facil(file, &(newWordAndHint));
CU_ASSERT_NOT_EQUAL(newWordAndHint2.word, newWordAndHint.word);

}

void test_VerifygetWordSecondRoundMediumisWorking(void){
wordAndHints newWordAndHint;
wordAndHints newWordAndHint2;
FILE *file;
file = fopen("dicas_primeira_fase.txt","r");
segunda_fase_medio(file, &(newWordAndHint));
CU_ASSERT_NOT_EQUAL(newWordAndHint2.word, newWordAndHint.word);

}

void test_VerifygetWordSecondRoundHardisWorking(void){
wordAndHints newWordAndHint;
wordAndHints newWordAndHint2;
FILE *file;
file = fopen("dicas_primeira_fase.txt","r");
segunda_fase_dificil(file, &(newWordAndHint));
CU_ASSERT_NOT_EQUAL(newWordAndHint2.word , newWordAndHint.word);

}

void test_VerifygetSizeOfRankingisWorking(void){
FILE *file;
int size;
file = fopen("ranking.txt","r");
size = getSizeOfRanking(file);
CU_ASSERT_TRUE(size!=0);
}

void test_VerifygetSizeofRankingEmptyFile(void){
int size;
FILE *file;
file = fopen("rankingEmpty.txt", "r");
size = getSizeOfRanking(file);
CU_ASSERT_EQUAL(size,0);
}

void test_VerifygetSizeofRankingNullPointer(void){
int size;
FILE *file;
size = getSizeOfRanking(file);
CU_ASSERT_EQUAL(size,0);
}

void test_VerifygetSizeofRankingSize4(void){
int size;
FILE *file;
file = fopen("rankingTest.txt", "r");
size = getSizeOfRanking(file);
CU_ASSERT_EQUAL(size,4);
}

void test_VerifywriteRankingExample(void){
Ranking ranking;
ranking.scores.nome = "Exemplo";
ranking.scores.score = 100;
writeRanking(ranking);

}

void test_VerifycountLinesisWorking(void){
CU_ASSERT_TRUE( countLines() !=0);
}

void test_VerifyreadRankingisWorking(void){
Ranking ranking;
ranking = readRanking();
CU_ASSERT_TRUE(ranking==10)
}

void adicionar_testes_smo_datas(void){
CU_pSuite suite;

/*Cria uma suite que conterá todos os testes*/
suite = CU_add_suite("Testes da smo_datas",NULL,NULL);


/*Adiciona os testes para a função DT_data_valida*/
CU_ADD_TEST(suite, test_VerifygetWordFirstRoundisWorking);
CU_ADD_TEST(suite, test_VerifygetWordSecondRoundEasyisWorking);
CU_ADD_TEST(suite, test_VerifygetWordSecondRoundMediumisWorking);
CU_ADD_TEST(suite, test_VerifygetWordSecondRoundHardisWorking);
CU_ADD_TEST(suite, test_VerifycountLinesisWorking);
CU_ADD_TEST(suite, test_VerifyreadRankingisWorking);
CU_ADD_TEST(suite, test_VerifygetSizeofRankingEmptyFile);
CU_ADD_TEST(suite, test_VerifygetSizeofRankingNullPointer);
CU_ADD_TEST(suite, test_VerifygetSizeofRankingSize4);

}

int main(void){
/Inicializa o registro de suítes e testes do CUnit/
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();

/*Adiciona os testes ao registro*/  
adicionar_testes_smo_datas();
/*Muda o modo do CUnit para o modo VERBOSE
 O modo VERBOSE mostra algumas informacoes a
 mais na hora da execucao*/
CU_basic_set_mode(CU_BRM_VERBOSE);
/*Roda os testes e mostra na tela os resultados*/
CU_basic_run_tests();
/*Limpa o registro*/
CU_cleanup_registry();
return CU_get_error();

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.