Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void llenarVector(int vector[]) throws Exception{
- Random aleatorio=new Random();
- int n=Integer.MIN_VALUE;
- // System.out.println(vector.length);
- if (vector.length<=MAXIMO){
- for(int i=0; i<vector.length; i++)
- {
- boolean existe=true;
- while (existe)
- {
- n=aleatorio.nextInt(MAXIMO); /* Siguiente valor aleatorio */
- existe=comprobar_existe(vector,n);
- }
- vector[i]=n;
- }
- }else
- throw new Exception("Maximo 100 elementos");
- }
- @Test
- public void testValidos() throws Exception{
- System.out.println("Llenar vector");
- int[] vector1 = new int[3];
- int[] vectorResult= new int[3];
- VectorUtilidades instancia1 =new VectorUtilidades();
- instancia1.llenarVector(vector1);
- assertArrayEquals(vector1,vector1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement