|
no. i mean where i can find some example of code or pseudo code for coverage tool.
im just a student. im still learning about it. so i dont have so much knowledge about it. hope that you all can help me
|
|
|
|
|
Shakirin Mohd Amin wrote: where i can find some example of code or pseudo code for coverage tool.
I don't know what a coverage tool is, but if you search Google you should find some examples.
|
|
|
|
|
i've been searching for almost 1 month. but yet still didnt found any of that either sample source code or pseudo code ;(
|
|
|
|
|
What about these[^], first hits on Google; took me 5 seconds.
|
|
|
|
|
If you google for it you will find lots of information.
The two that I have heard mentioned most in connection with Java are Clover and Cobertura. There is also an open-source Java code coverage tool called Emma.
|
|
|
|
|
|
i've tried to look at those tolls before. but i doesnt give me any source code or guide to develop my own tool
|
|
|
|
|
yes, i found about clover & corbetura. but my problem now is how am i going to develop the code.
i know the flow of it. but i still don't know how to write the code.
|
|
|
|
|
Thats why they are called Open source you can get the source code of any program given the license supports it for example,
Look for the file with src[^]
|
|
|
|
|
actually im just developing a simple code in Java using NetBeans.
after i did some research, my code will just count the if and switch statement.
what should i do in order to read the code to be tested?
or else where i can found the pseudo code or source code for develop this simple code?
|
|
|
|
|
1. Finding the number of ifs and switches in a code is easy you need to use regular expressions in other words if statements and loops (yes plural).
2. For the testing part (simple but long yet risky) you need to read the source file and another regular expression to make sure that the place you will change the variable to an actual value is between the ifs and switches. After that output the file and compile and run using the runtime.getruntime method.
|
|
|
|
|
yes. that is the point. how am i going to read the source file (code to be tested)?
up until now I still couldnt find the code to read other source code
|
|
|
|
|
Shakirin Mohd Amin wrote: how am i going to read the source file
Source files are just straight text so you can read them with any of the standard readers in java. Read one line at a time, split the line into tokens and check for the particular keywords that you are interested in.
|
|
|
|
|
yes. i know about that token. but up until now i still couldnnt find the source code for splitting it into token as i only interested for keyword "if", "else" and "switch case" only.
where can i find the suitable code for that task?
|
|
|
|
|
Shakirin Mohd Amin wrote: where can i find the suitable code for that task?
You have to write it!
|
|
|
|
|
yes. that is it. my problem now is i couldn't find source code to read the source file & yet count the "if" & "switch" statement. this things make me stuck here ;(
|
|
|
|
|
how will I make my own mine sweeper game application using NetBeans?
|
|
|
|
|
See here[^] for Java samples which may help you.
|
|
|
|
|
|
I did try to use the codes but nothings work...did anybody get it right?????can anybody gonna help me???thanx
|
|
|
|
|
|
Hello. I did this..
package javaapplication6;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
System.out.println("Enter number of rows");
int m = Integer.parseInt(br.readLine());
System.out.println("Enter number of columns");
int n = Integer.parseInt(br.readLine());
int[][] first = new int[m][n];
int[][] second = new int[m][n];
int[][] sum = new int[m][n];
System.out.println("Enter Value of first matrix");
{
for (int i=0;i<m;m++)
{
for (int j=0; j<n;j++)
{
first[m][n] = Integer.parseInt(br.readLine());
}
}
}
System.out.println("Enter value of second matrix");
{
for (int i=0;i<m;m++)
{
System.out.println("Row no. " + (i+1));
for (int j=0;j<n;j++)
{
System.out.println("Enter value for column no. " + (j+1));
second[m][n] = Integer.parseInt(br.readLine());
}
}
}
System.out.println("Sum of two matrices are:");
{
for (int i=0;i<m;i++)
{
for (int j = 0; j<n;j++)
{
sum[m][n] = first[m][n] + second[m][n];
}
}
System.out.println(sum[m][n]);
}
}
catch (IOException e)
{
System.out.println(e);
}
}
}
Here in bold text..
first[m][n] = Integer.parseInt(br.readLine());
throws ArrayIndexOutOfBoundexception ....
When I replace first[m][n] with first[i][j] .. it taking value ..
how to rectify this error any suggestion..
|
|
|
|
|
nt_virus wrote: how to rectify this error any suggestion.
I think this statement for (int i=0;i<m;m++) has a slight error.
|
|
|
|
|
but that line add column values for 2nd row and so on till
|
|
|
|
|
nt_virus wrote: but that line add column values for 2nd row and so on till
Look closely, at the end of the loop you are incrementing the wrong variable
|
|
|
|