File: t.strutils.h

package info (click to toggle)
mimetic 0.9.6-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,656 kB
  • ctags: 1,746
  • sloc: cpp: 11,240; sh: 9,080; makefile: 115
file content (43 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _T_STRUTILS_H_
#define _T_STRUTILS_H_
#include <string>
#include <mimetic/strutils.h>
#include "cutee.h"


namespace mimetic
{

struct TEST_CLASS( testStrUtils  )
{
    void TEST_FUNCTION( test_remove_external_blanks )
    {
        struct test_item { const char *in, *out; };
        test_item data[] = { 
                { "", "" },
                { "a", "a" },
                { "aaaabbbb", "aaaabbbb" },
                { " a", "a" },
                { "a ", "a" },
                { " a ", "a" },
                { " abcd ", "abcd" },
                { "aaaabbbb", "aaaabbbb" },
                { "   aaaabbbb", "aaaabbbb" },
                { "   aaaabbbb   ", "aaaabbbb" },
                { 0, 0 }
                };
        for(int i = 0; data[i].in; ++i)
        {
            std::string s(data[i].in);
            std::string r = remove_external_blanks(s);
            TEST_ASSERT_EQUALS_P(r, data[i].out);

        }

    }
};

}

#endif