Skip to content

Commit

Permalink
Rename plan to encoding in e2e tests (#851)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Oct 9, 2024
1 parent 46e632e commit ac6cebb
Show file tree
Hide file tree
Showing 30 changed files with 10 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 10 additions & 9 deletions test/e2e/runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,23 @@ auto main(int argc, char *argv[]) -> int {
schema, sourcemeta::jsontoolkit::default_schema_walker,
sourcemeta::jsontoolkit::official_resolver, DEFAULT_METASCHEMA);

std::ofstream plan_output_stream(directory / "plan.json", std::ios::binary);
plan_output_stream.exceptions(std::ios_base::badbit);
std::ofstream encoding_output_stream(directory / "encoding.json",
std::ios::binary);
encoding_output_stream.exceptions(std::ios_base::badbit);
sourcemeta::jsontoolkit::prettify(
schema, plan_output_stream,
schema, encoding_output_stream,
sourcemeta::jsontoolkit::schema_format_compare);
plan_output_stream << "\n";
plan_output_stream.flush();
plan_output_stream.close();
encoding_output_stream << "\n";
encoding_output_stream.flush();
encoding_output_stream.close();

// Encoder
const sourcemeta::jsonbinpack::Encoding plan{
const sourcemeta::jsonbinpack::Encoding encoding{
sourcemeta::jsonbinpack::load(schema)};
std::ofstream output_stream(directory / "output.bin", std::ios::binary);
output_stream.exceptions(std::ios_base::badbit);
sourcemeta::jsonbinpack::Encoder encoder{output_stream};
encoder.write(instance, plan);
encoder.write(instance, encoding);
output_stream.flush();
const auto size{output_stream.tellp()};
output_stream.close();
Expand All @@ -83,7 +84,7 @@ auto main(int argc, char *argv[]) -> int {
std::ifstream data_stream{directory / "output.bin", std::ios::binary};
data_stream.exceptions(std::ios_base::badbit);
sourcemeta::jsonbinpack::Decoder decoder{data_stream};
const sourcemeta::jsontoolkit::JSON result = decoder.read(plan);
const sourcemeta::jsontoolkit::JSON result = decoder.read(encoding);

// Report results
if (result == instance) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ac6cebb

Please sign in to comment.