Example program to test JLANG::JString class.
More...
#include <string>
#include <iostream>
#include <fstream>
#include <locale>
#include <iomanip>
#include "JLang/JString.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 JLANG::JString class.
- Author
- mdejong
Definition in file JString.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 20 of file JString.cc.
29 JParser<> zap(
"Example program to test string operations.");
35 catch(
const exception &error) {
36 FATAL(error.what() << endl);
41 const JString buffer(
"% = %;",
"key", 123);
43 DEBUG(buffer << endl);
45 ASSERT(buffer ==
"key = 123;",
"Test formatting");
49 JString buffer(
"Hello world.");
51 DEBUG(buffer << endl);
55 DEBUG(buffer << endl);
57 ASSERT(buffer ==
"HELLO WORLD.",
"Test JString::toUpper()");
61 DEBUG(buffer << endl);
63 ASSERT(buffer ==
"hello world.",
"Test JString::toLower()");
67 JString buffer(
"a = %1; b = %2; c = %3;");
69 buffer.replace(
"%1", 3.1415).replace(
"%2",
"hello").replace(
"%3", 123);
71 DEBUG(buffer << endl);
73 ASSERT(buffer ==
"a = 3.1415; b = hello; c = 123;",
"Test JString::replace()");
78 int i = JString::toValue<int>(
"1234");
82 ASSERT(i == 1234,
"Test JString::toValue<int>()");
86 JString buffer(
"1 3.1415 hello");
92 buffer.assign(i).assign(d).assign(w);
94 DEBUG(i <<
' ' << d <<
' ' << w << endl);
96 ASSERT(i == 1 && d == 3.1415 && w ==
"hello",
"Test JString::assign()");
Utility class to parse command line options.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
#define DEBUG(A)
Message macros.