libtld: /home/snapwebsites/snapcpp/contrib/libtld/tests/tld_test.c File Reference

libtld  1.5.13
A library to determine the Top-Level Domain name of any URL.
tld_test.c File Reference

Test the tld() function like an end user. More...

#include "libtld/tld.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include "tld_data.h"
Include dependency graph for tld_test.c:

Go to the source code of this file.

Functions

void cat_ext (int offset, char *uri)
 Build an extension from any offset. More...
 
int main (int argc, char *argv[])
 
void test_all ()
 
void test_invalid ()
 
void test_unknown ()
 

Variables

int err_count = 0
 
const struct tld_description tld_descriptions []
 Array of all the TLDs defined in the tld_data.c file. More...
 
unsigned short tld_end_offset
 The end offset of the top-most top-level domain names. More...
 
unsigned short tld_start_offset
 The start offset of the top-most top-level-domain names. More...
 
int verbose = 0
 

Detailed Description

This file implements various tests verifying the tld() function. The tests defined here are not for coverage but rather edge cases which could be hard to expect in a full coverage test.

Definition in file tld_test.c.

Function Documentation

Variable Documentation

const struct tld_description tld_descriptions[]

This array is defined in the tld_data.c which is automatically generated by the tld_parser tool.

Definition at line 537 of file tld_data.c.

Referenced by cat_ext().

unsigned short tld_end_offset

This variable holds the end of the top-most domain names in the tld_descriptions table. It is always defined. It actually represents the last offset + 1 (i.e. it is exclusive like the f_end_offset of the tld_description structure.)

Note that this value also represents the size of of the tld_descriptions table since the list of top-most domain names are saved last.

Definition at line 10272 of file tld_data.c.

Referenced by cat_ext().

unsigned short tld_start_offset

This variable holds the start of the top-most domain names in the tld_descriptions table. It is always defined.

Definition at line 10271 of file tld_data.c.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly