| 1 | /* |
|---|
| 2 | * concat test suite. |
|---|
| 3 | * |
|---|
| 4 | * Written by Russ Allbery <rra@stanford.edu> |
|---|
| 5 | * Copyright 2009 Board of Trustees, Leland Stanford Jr. University |
|---|
| 6 | * Copyright (c) 2004, 2005, 2006 |
|---|
| 7 | * by Internet Systems Consortium, Inc. ("ISC") |
|---|
| 8 | * Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
|---|
| 9 | * 2002, 2003 by The Internet Software Consortium and Rich Salz |
|---|
| 10 | * |
|---|
| 11 | * See LICENSE for licensing terms. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #include <config.h> |
|---|
| 15 | #include <portable/system.h> |
|---|
| 16 | |
|---|
| 17 | #include <tests/tap/basic.h> |
|---|
| 18 | #include <util/util.h> |
|---|
| 19 | |
|---|
| 20 | #define END (char *) 0 |
|---|
| 21 | |
|---|
| 22 | /* |
|---|
| 23 | * Memory leaks everywhere! Whoo-hoo! |
|---|
| 24 | */ |
|---|
| 25 | int |
|---|
| 26 | main(void) |
|---|
| 27 | { |
|---|
| 28 | plan(13); |
|---|
| 29 | |
|---|
| 30 | is_string("a", concat("a", END), "concat 1"); |
|---|
| 31 | is_string("ab", concat("a", "b", END), "concat 2"); |
|---|
| 32 | is_string("ab", concat("ab", "", END), "concat 3"); |
|---|
| 33 | is_string("ab", concat("", "ab", END), "concat 4"); |
|---|
| 34 | is_string("", concat("", END), "concat 5"); |
|---|
| 35 | is_string("abcde", concat("ab", "c", "", "de", END), "concat 6"); |
|---|
| 36 | is_string("abcde", concat("abc", "de", END, "f", END), "concat 7"); |
|---|
| 37 | |
|---|
| 38 | is_string("/foo", concatpath("/bar", "/foo"), "path 1"); |
|---|
| 39 | is_string("/foo/bar", concatpath("/foo", "bar"), "path 2"); |
|---|
| 40 | is_string("./bar", concatpath("/foo", "./bar"), "path 3"); |
|---|
| 41 | is_string("/bar/baz/foo/bar", concatpath("/bar/baz", "foo/bar"), "path 4"); |
|---|
| 42 | is_string("./foo", concatpath(NULL, "foo"), "path 5"); |
|---|
| 43 | is_string("/foo/bar", concatpath(NULL, "/foo/bar"), "path 6"); |
|---|
| 44 | |
|---|
| 45 | return 0; |
|---|
| 46 | } |
|---|