passByObject
This commit is contained in:
parent
e87a9df4de
commit
6c0e1223c4
1 changed files with 35 additions and 7 deletions
|
@ -13,14 +13,9 @@ public abstract class TestCase<RequestFactory extends StructFactory<RequestBuild
|
|||
public abstract void handleRequest(RequestReader request, ResponseBuilder response);
|
||||
public abstract boolean checkResponse(ResponseReader response, Expectation expected);
|
||||
|
||||
public void execute(String[] args, RequestFactory requestFactory, ResponseFactory responseFactory) {
|
||||
|
||||
if (args.length != 4) {
|
||||
System.out.println("USAGE: TestCase MODE REUSE COMPRESSION ITERATION_COUNT");
|
||||
return;
|
||||
}
|
||||
|
||||
long iters = Long.parseLong(args[3]);
|
||||
public void passByObject(RequestFactory requestFactory, ResponseFactory responseFactory,
|
||||
long iters) {
|
||||
|
||||
Common.FastRand rng = new Common.FastRand();
|
||||
|
||||
|
@ -35,7 +30,40 @@ public abstract class TestCase<RequestFactory extends StructFactory<RequestBuild
|
|||
System.out.println("mismatch!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void passByBytes(RequestFactory requestFactory, ResponseFactory responseFactory,
|
||||
long iters) {
|
||||
|
||||
Common.FastRand rng = new Common.FastRand();
|
||||
|
||||
for (int i = 0; i < iters; ++i) {
|
||||
MessageBuilder requestMessage = new MessageBuilder();
|
||||
MessageBuilder responseMessage = new MessageBuilder();
|
||||
// TODO
|
||||
throw new Error("unimplemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void execute(String[] args, RequestFactory requestFactory, ResponseFactory responseFactory) {
|
||||
|
||||
if (args.length != 4) {
|
||||
System.out.println("USAGE: TestCase MODE REUSE COMPRESSION ITERATION_COUNT");
|
||||
return;
|
||||
}
|
||||
|
||||
String mode = args[0];
|
||||
String reuse = args[1];
|
||||
String compression = args[2];
|
||||
long iters = Long.parseLong(args[3]);
|
||||
|
||||
if (mode.equals("object")) {
|
||||
passByObject(requestFactory, responseFactory, iters);
|
||||
} else if (mode.equals("bytes")) {
|
||||
passByBytes(requestFactory, responseFactory, iters);
|
||||
} else {
|
||||
System.out.println("unknown mode: " + mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue