Skip to content

Commit 600cb89

Browse files
committed
major update.
add support for parallel execution. more configuration options. MemoryOutOfBoundsError solved.
1 parent 524f6ae commit 600cb89

File tree

14 files changed

+143
-33
lines changed

14 files changed

+143
-33
lines changed

ProgramTesterUser.jar

17.2 KB
Binary file not shown.

config.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ problem_dir :- resources\ProbDef\
33
source_data_dir :- resources\Data\
44
local_logger_dir :- resources\temp\log\
55
network_logger_ip :- 127.0.0.1
6-
network_logger_port :- 8686
6+
network_logger_port :- 8686
7+
#parallel_execution :- false
8+
parallel_thread :- 2

gmon.out

0 Bytes
Binary file not shown.

nbproject/private/private.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
<group>
66
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/ui/cli/CliUser.java</file>
77
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/programtester/ProgramTester.java</file>
8-
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/userModule/IntUserFlow.java</file>
9-
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/ui/IntUI.java</file>
10-
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/userModule/result/IntProgramState.java</file>
8+
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/runTest/RunTest.java</file>
9+
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/userModule/SingleUserFlow.java</file>
10+
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/programtester/config/Configurator.java</file>
11+
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/userModule/test/Test.java</file>
12+
<file>file:/C:/My%20folder/Fun/Data/Program%20Tester/src/lib/dT/manipulate/comparators/StringComparators.java</file>
1113
</group>
1214
</open-files>
1315
</project-private>

resources/ProbDef/170215054628_Write a program to check whether the entered strings are palindrome or not..txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
170215054628
33
@title
44
Write a program to check whether the entered strings are palindrome or not.
5+
@description
56
Palindrome strings are the ones that are read same if reversed (By example, rar is rar if reversed).
67
make a program to determine that the string is palindrome or not.
78
Write a program to check whether the entered strings are palindrome or not.

resources/gmon.out

0 Bytes
Binary file not shown.

resources/prop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void main()
1212
scanf("%d",&s[i]);
1313
merge(&s[0],l);
1414
for(i=0;i<l;i++)
15-
printf("%d45\n\n",s[i]);
15+
printf("%d \n\n",s[i]);
1616
}
1717
void merge(long *a,long i)
1818
{

resources/prop.exe

0 Bytes
Binary file not shown.

src/lib/dT/manipulate/comparators/ListManipulator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public static boolean compare(List<String>o1,List<String>o2,
3737
}
3838
}catch(NoSuchElementException e){
3939
return false;
40+
}finally{
41+
System.gc();
4042
}
41-
return false;
43+
return false;
4244
}
4345

4446
/**
@@ -55,7 +57,7 @@ public static boolean compare(List<String>o1,List<String>o2,
5557
from {@code li}.
5658
*/
5759
public static List<String> removeNull(List<String> li){
58-
return li.stream().filter(s->s!=null&&s!="")
60+
return li.stream().filter(s->!s.trim().isEmpty())
5961
.collect(Collectors.toList());
6062
}
6163

src/lib/runTest/ProgramExecuter.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
class ProgramExecuter {
1313
boolean executed=false;
1414
String cmd;
15-
ProcessBuilder pb; //used to create subprocess
15+
//ProcessBuilder pb; //used to create subprocess
1616
Process pr; //refer to the subprocess
1717
Thread tin,tout; //refer to the thread which give input and output
1818
List<String> input; //input of subprocess
1919
List<String> output; //output of subprocess
20-
Scanner sc; //Scanner bind to standard outputStream and error stream
20+
//Scanner sc; //Scanner bind to standard outputStream and error stream
2121
long time=-1; //time taken by subprocess in milli secounds.
2222
BufferedReader in;
2323
PrintWriter out; //bind to standard input stream of subprocess.
@@ -31,8 +31,8 @@ class ProgramExecuter {
3131
ProgramExecuter(List<String> input,String cmd){
3232
this.input=input;
3333
this.cmd=cmd;
34-
pb=new ProcessBuilder(cmd);
35-
pb.redirectErrorStream(true); //error stream bind with the output steam of subprocess
34+
//pb=new ProcessBuilder(cmd);
35+
//pb.redirectErrorStream(true); //error stream bind with the output steam of subprocess
3636
output=new ArrayList<>();
3737
}
3838

@@ -57,10 +57,10 @@ synchronized List<String> execute(long time) throws IOException{
5757
pr=Runtime.getRuntime().exec(cmd);
5858
//pr=pb.start(); //start new subprocess.
5959
//System.out.println("ProgramExecuter.execute :- started");
60-
//in=new BufferedReader(new InputStreamReader(pr.getInputStream()));
60+
in=new BufferedReader(new InputStreamReader(pr.getInputStream()));
6161
//in=new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
6262
out=new PrintWriter(new BufferedOutputStream(pr.getOutputStream()));
63-
sc=new Scanner(pr.getInputStream());
63+
//sc=new Scanner(pr.getInputStream());
6464
tin=new Thread(this::giveIn); //create thread to give input to subprocess
6565
tout=new Thread(this::getOut); //create thread to get output of subprocess
6666
tout.start();
@@ -91,8 +91,12 @@ void stop(){
9191
pr.destroyForcibly();
9292
}
9393
if(tin!=null&&tin.isAlive()){
94-
sc.close();
95-
//tin.destroy();
94+
try {
95+
//sc.close();
96+
in.close();
97+
//tin.destroy();
98+
} catch (IOException ex) {
99+
}
96100
}
97101
if(tout!=null&&tout.isAlive()){
98102
//tout.destroy();
@@ -133,17 +137,18 @@ private void giveIn(){
133137
private void getOut(){
134138
//System.out.println("ProgramExecuter.getOut :- started");
135139
//for(;pr.isAlive();){
136-
//in.lines().forEach(s->output.add(s));
137-
sc.forEachRemaining(s->{
140+
in.lines().limit(200000).forEach(s->output.add(s));
141+
/*sc.forEachRemaining(s->{
138142
try{
139143
//String s=in.readLine();
140144
output.add(s);
141145
//System.out.println("ProgramExecuter.getout :- get out "+s);
142146
}catch(NoSuchElementException ex){
143147
//System.out.println(ex);
144148
}
145-
});
149+
});*/
146150
//System.out.println("ProgramExecuter.getOut : - ended");
151+
//System.gc();
147152
}
148153

149154
/**return runtime of subprocess in milli seconds.

0 commit comments

Comments
 (0)