/** @(#)TestXMatrix.java 2009 adolfo@di-mare.com Datos de prueba para {@code xMatrix()}. @author Adolfo Di Mare */ import junit.framework.*; /** Datos de prueba para {@code xMatrix()}. */ public class TestXMatrix extends TestCase { /** Rellena con una gran "X" la matriz cuadrada {@code M[][]}. * */ public static void xMatrix( char M[][] ) { if ( M.equals(null) ) { // M[][] no existe todavía return; } else if ( M.length==0 ) { return; } else if ( M[0].length != M.length ) { return; // M[][] no es cuadrada } if ( true ) { /******************************\ * * * RELLENE CON SU ALGORITMO * * * \******************************/ } return; } /* 0 1 2 3 4 5 6 7 8 9 10 +---+---+---+---+---+---+---+---+---+---+ 0 | X | | | | | | | | | X | +---+---+---+---+---+---+---+---+---+---+ 1 | | X | | | | | | | X | | +---+---+---+---+---+---+---+---+---+---+ 2 | | | X | | | | | X | | | +---+---+---+---+---+---+---+---+---+---+ 3 | | | | X | | | X | | | | +---+---+---+---+---+---+---+---+---+---+ 4 | | | | | X | X | | | | | +---+---+---+---+---+---+---+---+---+---+ 5 | | | | | X | X | | | | | +---+---+---+---+---+---+---+---+---+---+ 6 | | | | X | | | X | | | | +---+---+---+---+---+---+---+---+---+---+ 7 | | | X | | | | | X | | | +---+---+---+---+---+---+---+---+---+---+ 8 | | X | | | | | | | X | | +---+---+---+---+---+---+---+---+---+---+ 9 | X | | | | | | | | | X | +---+---+---+---+---+---+---+---+---+---+ */ /** test -> {@code xMatrix()}. */ public void test_xMatrix() { for ( int N=0; N<166; ++N ) { char M[][]= new char[N][N]; xMatrix( M ); // grabaMatrix( M ); int diag = 0, contraDiag = 0; for ( int i=0; i0 ? contraDiag-1 : N-1 ); for ( int j=0; j