Example program to test JTOOLS::JRouter class.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "JTools/JRouter.hh"
#include "JLang/JObjectID.hh"
#include "JIO/JFileStreamIO.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test JTOOLS::JRouter class.
- Author
- mdejong
Definition in file JRouter.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 21 of file JRouter.cc.
30 JParser<> zap(
"Example program to test router.");
36 catch(
const exception &error) {
37 FATAL(error.what() << endl);
41 JRouter<int> router(-1);
47 for (
int i = 1;
i <= 1000000;
i *= 10) {
51 for (
size_t i = 0;
i != buffer.size(); ++
i) {
52 router.put(buffer[
i], i);
55 ASSERT(!router.in_range(0),
"Test of router range.");
56 ASSERT(!router.has(2),
"Test of router has.");
58 for (
int i = 1;
i <= 1000000;
i *= 10) {
59 ASSERT(router.in_range(
i),
"Test of router range.");
60 ASSERT(router.has(
i),
"Test of router has.");
61 ASSERT(buffer[router.get(
i)] ==
i,
"Test of router lookup.");
69 for (
int i = 1000000;
i >= 1;
i /= 10) {
73 for (
size_t i = 0;
i != buffer.size(); ++
i) {
74 router.put(buffer[
i], i);
77 ASSERT(!router.in_range(0),
"Test of router range.");
78 ASSERT(!router.has(2),
"Test of router has.");
80 for (
int i = 1000000;
i >= 1;
i /= 10) {
81 ASSERT(router.in_range(
i),
"Test of router range.");
82 ASSERT(router.has(
i),
"Test of router has.");
83 ASSERT(buffer[router.get(
i)] ==
i,
"Test of router.");
Utility class to parse command line options.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object