Ada 4.1.1
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
url_pattern_list.cc File Reference
#include <fuzzer/FuzzedDataProvider.h>
#include <cstdio>
#include <cstdlib>
#include <optional>
#include <string>
#include <vector>
#include "ada.cpp"
#include "ada.h"

Go to the source code of this file.

Classes

struct  reference_route

Typedefs

using list_type = ada::url_pattern_list<regex_provider>
using groups_type = std::vector<std::optional<std::string>>

Functions

static bool build_reference (const std::vector< std::string > &patterns, const ada::url_pattern_options &options, std::vector< reference_route > &out)
static int32_t reference_match (const std::vector< reference_route > &routes, std::string_view pathname, groups_type &groups)
static void exercise_match_result (const ada::url_pattern_list_match_result &result)
static void fail (const char *what, const std::string &input, const std::vector< std::string > &patterns)
static void check_agreement (const list_type &list, const std::vector< reference_route > &reference, const std::vector< std::string > &patterns, const std::string &input)
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)

Typedef Documentation

◆ groups_type

using groups_type = std::vector<std::optional<std::string>>

Definition at line 18 of file url_pattern_list.cc.

◆ list_type

using list_type = ada::url_pattern_list<regex_provider>

Definition at line 16 of file url_pattern_list.cc.

Function Documentation

◆ build_reference()

bool build_reference ( const std::vector< std::string > & patterns,
const ada::url_pattern_options & options,
std::vector< reference_route > & out )
static

Definition at line 32 of file url_pattern_list.cc.

References reference_route::info, and reference_route::pattern.

Referenced by LLVMFuzzerTestOneInput().

◆ check_agreement()

void check_agreement ( const list_type & list,
const std::vector< reference_route > & reference,
const std::vector< std::string > & patterns,
const std::string & input )
static

◆ exercise_match_result()

void exercise_match_result ( const ada::url_pattern_list_match_result & result)
static

Definition at line 88 of file url_pattern_list.cc.

Referenced by check_agreement().

◆ fail()

void fail ( const char * what,
const std::string & input,
const std::vector< std::string > & patterns )
static

Definition at line 106 of file url_pattern_list.cc.

Referenced by check_agreement().

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t * data,
size_t size )

Definition at line 171 of file url_pattern_list.cc.

References build_reference(), and check_agreement().

◆ reference_match()

int32_t reference_match ( const std::vector< reference_route > & routes,
std::string_view pathname,
groups_type & groups )
static

Definition at line 66 of file url_pattern_list.cc.

References reference_route::info, and reference_route::pattern.

Referenced by check_agreement().