<commit_before>// -*- Mode:C++ -*-

/**************************************************************************************************/
/*                                                                                                */
/* Copyright (C) 2014 University of Hull                                                          */
/*                                                                                                */
/**************************************************************************************************/
/*                                                                                                */
/*  module     :  scene/visitor/test/visitor_print.cpp                                            */
/*  project    :                                                                                  */
/*  description:                                                                                  */
/*                                                                                                */
/**************************************************************************************************/

// includes, system

#include <iostream> // std::cout

// includes, project

#include <scene/node/group.hpp>
#include <scene/visitor/print.hpp>

#include <visitor_shared.hpp>

#define UKACHULLDCS_USE_TRACE
#undef UKACHULLDCS_USE_TRACE
#include <support/trace.hpp>

// internal unnamed namespace

namespace {
  
  // types, internal (class, enum, struct, union, typedef)

  class simple_bfs : public scene::visitor::bfs {

  public:
    
    virtual ~simple_bfs() { /* ... */ }

  private:

    virtual void visit(scene::visitor::subject&) { /* ... */ }
    
  };

  class simple_dfs : public scene::visitor::dfs {

  public:
    
    virtual ~simple_dfs() { /* ... */ }

  private:

    virtual void visit(scene::visitor::subject&) { /* ... */ }
    
  };
  
  // variables, internal
  
  // functions, internal
  
} // namespace {

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_simple_bfs)
{
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);

  simple_bfs v;
  
  g->accept(v);
    
  delete g;
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_simple_dfs)
{
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);

  simple_dfs v;

  g->accept(v);
  
  delete g;
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_graph_bfs)
{
  boost::test_tools::output_test_stream output;
  
  {
    // needs to be in a scope to ensure bfs' dtor is run to flush
    using namespace scene;
  
    node::group* g(test::make_scene());
  
    BOOST_CHECK(nullptr != g);
  
    visitor::print pv(output, visitor::print::order::bfs);
    
    g->accept(pv);

#if 1
    visitor::print pv1(std::cout, visitor::print::order::bfs);
    g->accept(pv1);
#endif
    
    delete g;
  }

  BOOST_CHECK(!output.is_empty(false));
  // BOOST_CHECK( output.check_length(6356, false));
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_graph_dfs)
{
  boost::test_tools::output_test_stream output;
  
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);
  
  visitor::print pv(output, visitor::print::order::dfs);
  g->accept(pv);
  
#if 0
  visitor::print pv1(std::cout, visitor::print::order::dfs);
  g->accept(pv1);
#endif
    
  BOOST_CHECK(!output.is_empty(false));
  // BOOST_CHECK( output.check_length(6356, false));
  
  delete g;
}
<commit_msg>fixed: verbosity<commit_after>// -*- Mode:C++ -*-

/**************************************************************************************************/
/*                                                                                                */
/* Copyright (C) 2014 University of Hull                                                          */
/*                                                                                                */
/**************************************************************************************************/
/*                                                                                                */
/*  module     :  scene/visitor/test/visitor_print.cpp                                            */
/*  project    :                                                                                  */
/*  description:                                                                                  */
/*                                                                                                */
/**************************************************************************************************/

// includes, system

#include <iostream> // std::cout

// includes, project

#include <scene/node/group.hpp>
#include <scene/visitor/print.hpp>

#include <visitor_shared.hpp>

#define UKACHULLDCS_USE_TRACE
#undef UKACHULLDCS_USE_TRACE
#include <support/trace.hpp>

// internal unnamed namespace

namespace {
  
  // types, internal (class, enum, struct, union, typedef)

  class simple_bfs : public scene::visitor::bfs {

  public:
    
    virtual ~simple_bfs() { /* ... */ }

  private:

    virtual void visit(scene::visitor::subject&) { /* ... */ }
    
  };

  class simple_dfs : public scene::visitor::dfs {

  public:
    
    virtual ~simple_dfs() { /* ... */ }

  private:

    virtual void visit(scene::visitor::subject&) { /* ... */ }
    
  };
  
  // variables, internal
  
  // functions, internal
  
} // namespace {

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_simple_bfs)
{
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);

  simple_bfs v;
  
  g->accept(v);
    
  delete g;
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_simple_dfs)
{
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);

  simple_dfs v;

  g->accept(v);
  
  delete g;
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_graph_bfs)
{
  boost::test_tools::output_test_stream output;
  
  {
    // needs to be in a scope to ensure bfs' dtor is run to flush
    using namespace scene;
  
    node::group* g(test::make_scene());
  
    BOOST_CHECK(nullptr != g);
  
    visitor::print pv(output, visitor::print::order::bfs);
    
    g->accept(pv);

#if 0
    visitor::print pv1(std::cout, visitor::print::order::bfs);
    g->accept(pv1);
#endif
    
    delete g;
  }

  BOOST_CHECK(!output.is_empty(false));
  // BOOST_CHECK( output.check_length(6356, false));
}

BOOST_AUTO_TEST_CASE(test_scene_visitor_print_graph_dfs)
{
  boost::test_tools::output_test_stream output;
  
  using namespace scene;
  
  node::group* g(test::make_scene());
  
  BOOST_CHECK(nullptr != g);
  
  visitor::print pv(output, visitor::print::order::dfs);
  g->accept(pv);
  
#if 0
  visitor::print pv1(std::cout, visitor::print::order::dfs);
  g->accept(pv1);
#endif
    
  BOOST_CHECK(!output.is_empty(false));
  // BOOST_CHECK( output.check_length(6356, false));
  
  delete g;
}

{'fraction_non_alphanumeric': 0.20005545542769998, 'fraction_numerical': 0.004990988492998752, 'mean_word_length': 1.8718152866242037, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3295011', 'n_tokens_mistral': 2066, 'n_tokens_neox': 1997, 'n_words': 339}