CatRank stub
This commit is contained in:
parent
c797a7d2a4
commit
3afd3d5b61
5 changed files with 42 additions and 11 deletions
|
@ -1,6 +1,5 @@
|
|||
package org.capnproto.benchmark;
|
||||
|
||||
import org.capnproto.MessageBuilder;
|
||||
import org.capnproto.StructList;
|
||||
import org.capnproto.Text;
|
||||
import org.capnproto.benchmark.CarSalesSchema.*;
|
||||
|
@ -115,13 +114,8 @@ public class CarSales
|
|||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Common.FastRand rng = new Common.FastRand();
|
||||
|
||||
TestCase<ParkingLot.Factory, ParkingLot.Builder, ParkingLot.Reader,
|
||||
TotalValue.Factory, TotalValue.Builder, TotalValue.Reader, Long> testCase = new CarSales();
|
||||
|
||||
testCase.execute(ParkingLot.factory, TotalValue.factory);
|
||||
|
||||
CarSales testCase = new CarSales();
|
||||
testCase.execute(args, ParkingLot.factory, TotalValue.factory);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
24
benchmark/src/main/java/org/capnproto/benchmark/CatRank.java
Normal file
24
benchmark/src/main/java/org/capnproto/benchmark/CatRank.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package org.capnproto.benchmark;
|
||||
|
||||
import org.capnproto.MessageBuilder;
|
||||
import org.capnproto.StructList;
|
||||
import org.capnproto.Text;
|
||||
import org.capnproto.benchmark.CatRankSchema.*;
|
||||
|
||||
public class CatRank
|
||||
extends TestCase<SearchResultList.Factory, SearchResultList.Builder, SearchResultList.Reader,
|
||||
SearchResultList.Factory, SearchResultList.Builder, SearchResultList.Reader, Integer> {
|
||||
|
||||
|
||||
public Integer setupRequest(Common.FastRand rng, SearchResultList.Builder request) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void handleRequest(SearchResultList.Reader request, SearchResultList.Builder response) {
|
||||
}
|
||||
|
||||
public boolean checkResponse(SearchResultList.Reader response, Integer expectedGoodCount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -82,4 +82,9 @@ public class Eval
|
|||
public final boolean checkResponse(EvaluationResult.Reader response, Integer expected) {
|
||||
return response.getValue() == expected;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Eval testCase = new Eval();
|
||||
testCase.execute(args, Expression.factory, EvaluationResult.factory);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,18 @@ 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(RequestFactory requestFactory, ResponseFactory responseFactory) {
|
||||
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]);
|
||||
|
||||
Common.FastRand rng = new Common.FastRand();
|
||||
|
||||
for (int i = 0; i < 50000; ++i) {
|
||||
for (int i = 0; i < iters; ++i) {
|
||||
MessageBuilder requestMessage = new MessageBuilder();
|
||||
MessageBuilder responseMessage = new MessageBuilder();
|
||||
RequestBuilder request = requestMessage.initRoot(requestFactory);
|
||||
|
|
|
@ -28,7 +28,7 @@ $Cxx.namespace("capnp::benchmark::capnp");
|
|||
|
||||
using Java = import "/java_support/java.capnp";
|
||||
$Java.package("org.capnproto.benchmark");
|
||||
$Java.outerClassname("CatrankSchema");
|
||||
$Java.outerClassname("CatRankSchema");
|
||||
|
||||
struct SearchResultList {
|
||||
results@0: List(SearchResult);
|
||||
|
|
Loading…
Reference in a new issue