XP : TestaBaralho

XP » XP » WebHome » TrabalhosFinais » JogoDoMeio » TestesParaOJogoDoMeio » TestaBaralho

-- AndreGermanoRegert - 04 Jul 2005

Classe TestaBaralho


/*
 * Criado em 02/07/2005
 */
package testesDoJogoDoMeio;

/**
 * @author André Germano Regert
 *          Jader Wallauer
 */

import jogoDoMeio.Baralho;

/**
 * @author BodomChilD
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class testaBaralho {

   public static void main(String[] args) {
      
      TestaNaipes();
      TestaCartas();
      TestaEstaCompleto();
      TestaEmbaralha();
      TestaTiraCarta();
            
      System.out.println("Baralho OK");
   }
   
   public static void TestaNaipes(){
      try {
         Baralho b = new Baralho(3,52);
        } catch (AssertionError ae) {
           assert ae.getMessage().equals("O baralho precisa ter 4 naipes");
            //if (ae.getMessage().equals("O baralho precisa ter 4 naipes")) {
            //throw ae; 
         //}
        }  
   }

   public static void TestaCartas(){
      try {
         Baralho b = new Baralho(4,53);
        } catch (AssertionError ae) {
           ae.getMessage().equals("O baralho precisa ter 52 cartas");
            //if (ae.getMessage().equals("O baralho precisa ter 52 cartas")) {
            //throw ae; 
         //}
        }  
   }
      
   public static void TestaEstaCompleto(){
      Baralho b = new Baralho(4,52);
      assert b.EstaCompleto() : "O baralho não está completo";
   }
   
   public static void TestaEmbaralha(){
      Baralho b = new Baralho(4,52);
      b.Embaralha();
      assert b.EstaEmbaralhado() : "O Baralho não foi embaralhado";
   }
   
   public static void TestaTiraCarta(){
      Baralho b = new Baralho(4,52);
      int carta = b.TiraCarta();
      assert (1 <= carta) && (13 >= carta): "Não foi retirada uma carta";
   }
      
}


E D U G R A F - Laboratório de Software Educacional - UFSC - CTC - INE
Campus Universitário - Trindade, Florianópolis, SC, Brasil 88040-090
Fone: +55 48 331 9735 / Fax: +55 48 331-9770