Include "callbacks.h"
This commit is contained in:
41
src/test.cpp
41
src/test.cpp
@@ -9,6 +9,7 @@
|
||||
#include <nanobench.h>
|
||||
#include <simdjson.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "minify.h"
|
||||
#include "parser3.h"
|
||||
|
||||
@@ -145,46 +146,6 @@ const std::string json = R"({
|
||||
}
|
||||
})";
|
||||
|
||||
Callbacks printCallbacks() {
|
||||
Callbacks result;
|
||||
result.on_begin_object = +[](void *) { puts("on_begin_object"); };
|
||||
result.on_end_object = +[](void *) { puts("on_end_object"); };
|
||||
result.on_begin_string = +[](void *) { puts("on_begin_string"); };
|
||||
result.on_string_data = +[](void *, const char *buf, int len) {
|
||||
printf("on_string_data `%.*s`\n", len, buf);
|
||||
};
|
||||
result.on_end_string = +[](void *) { puts("on_end_string"); };
|
||||
result.on_begin_array = +[](void *) { puts("on_begin_array"); };
|
||||
result.on_end_array = +[](void *) { puts("on_end_array"); };
|
||||
result.on_begin_number = +[](void *) { puts("on_begin_number"); };
|
||||
result.on_number_data = +[](void *, const char *buf, int len) {
|
||||
printf("on_number_data `%.*s`\n", len, buf);
|
||||
};
|
||||
result.on_end_number = +[](void *) { puts("on_end_number"); };
|
||||
result.on_true_literal = +[](void *) { puts("on_true_literal"); };
|
||||
result.on_false_literal = +[](void *) { puts("on_false_literal"); };
|
||||
result.on_null_literal = +[](void *) { puts("on_null_literal"); };
|
||||
return result;
|
||||
}
|
||||
|
||||
Callbacks noopCallbacks() {
|
||||
Callbacks result;
|
||||
result.on_begin_object = +[](void *) {};
|
||||
result.on_end_object = +[](void *) {};
|
||||
result.on_begin_string = +[](void *) {};
|
||||
result.on_string_data = +[](void *, const char *buf, int len) {};
|
||||
result.on_end_string = +[](void *) {};
|
||||
result.on_begin_array = +[](void *) {};
|
||||
result.on_end_array = +[](void *) {};
|
||||
result.on_begin_number = +[](void *) {};
|
||||
result.on_number_data = +[](void *, const char *buf, int len) {};
|
||||
result.on_end_number = +[](void *) {};
|
||||
result.on_true_literal = +[](void *) {};
|
||||
result.on_false_literal = +[](void *) {};
|
||||
result.on_null_literal = +[](void *) {};
|
||||
return result;
|
||||
}
|
||||
|
||||
void testStreaming(std::string const &json) {
|
||||
MinifyState streaming;
|
||||
MinifyState batch;
|
||||
|
||||
Reference in New Issue
Block a user