<commit_before>#include "wvtest.h"
#include "tripgraph.h"

using namespace std;


WVTEST_MAIN("basic_graph_pathfinding")
{
    TripGraph g;
    
    // simple path, just walking
    g.add_tripstop(0, TripStop::OSM, 0.0f, 0.0f);
    g.add_tripstop(1, TripStop::OSM, 1.0f, 0.0f);
    g.add_walkhop(0, 1);

    {
        TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);
        
        std::list<TripAction> actions = p->get_actions();
        WVPASSEQ(actions.size(), 1);
        
        TripAction action = actions.front();
        WVPASSEQ(action.src_id, 0);
        WVPASSEQ(action.dest_id, 1);
    }

    // take the triphop if we have it
    {
        ServicePeriod s("all", 0, 0, 0, 7, 0, 100, 2000, true, true, true);
        g.add_service_period(s);
        g.add_triphop(500, 1000, 0, 1, 1, 1, "all");
    }

    {
        TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);
        
        std::list<TripAction> actions = p->get_actions();
        WVPASSEQ(actions.size(), 1);
        
        TripAction action = actions.front();
        WVPASSEQ(action.src_id, 0);
        WVPASSEQ(action.dest_id, 1);
        WVPASSEQ(action.start_time, 500.0f);<commit_msg>Fix minor memory leak in tripgraph unit test<commit_after>#include "wvtest.h"
#include "tripgraph.h"

using namespace std;


WVTEST_MAIN("basic_graph_pathfinding")
{
    TripGraph g;
    
    // simple path, just walking
    g.add_tripstop(0, TripStop::OSM, 0.0f, 0.0f);
    g.add_tripstop(1, TripStop::OSM, 1.0f, 0.0f);
    g.add_walkhop(0, 1);

    {
        TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);
        
        std::list<TripAction> actions = p->get_actions();
        WVPASSEQ(actions.size(), 1);
        
        TripAction action = actions.front();
        WVPASSEQ(action.src_id, 0);
        WVPASSEQ(action.dest_id, 1);

        delete p;
    }

    // take the triphop if we have it
    {
        ServicePeriod s("all", 0, 0, 0, 7, 0, 100, 2000, true, true, true);
        g.add_service_period(s);
        g.add_triphop(500, 1000, 0, 1, 1, 1, "all");
    }

    {
        TripPath *p = g.find_path(0, false, 0.0, 0.0, 1.0, 0.0);
        
        std::list<TripAction> actions = p->get_actions();
        WVPASSEQ(actions.size(), 1);
        
        TripAction action = actions.front();
        WVPASSEQ(action.src_id, 0);
        WVPASSEQ(action.dest_id, 1);
        WVPASSEQ(action.start_time, 500.0f);
{'fraction_non_alphanumeric': 0.15425971877584782, 'fraction_numerical': 0.052109181141439205, 'mean_word_length': 2.255720053835801, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2799776', 'n_tokens_mistral': 1063, 'n_tokens_neox': 937, 'n_words': 194}