Created
September 29, 2010 14:08
-
-
Save lucihana/602801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To change this template, choose Tools | Templates | |
# and open the template in the editor. | |
#@author Marco Moura @marcomoura | |
#@author Luciana Mendes @lucihana | |
#@author Carlos Eduardo @carlos_tumulto | |
#@author Natalia Martins @nati57 | |
#@author Matheus E. Muller hello at memuller com | |
#@author Patricia Carvalho @patfcarv | |
#@author Rafael Salomão Gavazzi @razzi | |
class QuizAnimal | |
def self.pergunta pergunta | |
false | |
end | |
def self.armazena_animal animal | |
true | |
end | |
def self.armazena_pergunta pergunta | |
pergunta | |
end | |
def self.armazena_resposta pergunta, resposta | |
true | |
end | |
def self.verifica_resposta resposta | |
if(resposta) | |
"é um coelho?" | |
else | |
"é um elefante?" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To change this template, choose Tools | Templates | |
# and open the template in the editor. | |
#@author Luciana Mendes @lucihana | |
#@author Carlos Eduardo @carlos_tumulto | |
#@author Natalia Martins @nati57 | |
#@author Matheus E. Muller hello at memuller com | |
#@author Patricia Carvalho @patfcarv | |
#@author Rafael Salomão Gavazzi @razzi | |
$:.unshift File.join(File.dirname(__FILE__),'..','lib') | |
require 'test/unit' | |
require 'quiz_animal' | |
class QuizAnimalTest < Test::Unit::TestCase | |
def test_errar_primeira_resposta | |
resposta = QuizAnimal.pergunta("é um elefante") | |
assert_equal(false, resposta) | |
end | |
def test_armazena_animal | |
resposta = QuizAnimal.armazena_animal("coelho") | |
assert_equal(true, resposta) | |
end | |
def test_armazena_pergunta | |
pergunta = QuizAnimal.armazena_pergunta("É um animal Pequeno?") | |
assert_equal("É um animal Pequeno?",pergunta) | |
end | |
def test_armazernar_resposta_da_pergunta | |
resposta = QuizAnimal.armazena_resposta("É um animal Pequeno?",true) | |
assert_equal(true, resposta) | |
end | |
def test_ensinando_maquina | |
resposta = QuizAnimal.armazena_resposta("É um animal Pequeno?", false) | |
end | |
def test_saber_responder_quando_for_falso_e_um_elefante | |
resposta = QuizAnimal.verifica_resposta(false) | |
assert_equal('é um elefante?', resposta) | |
end | |
def test_saber_responder_quando_for_verdadeiro_e_um_coelho | |
resposta = QuizAnimal.verifica_resposta(true) | |
assert_equal('é um coelho?', resposta) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment