about summary refs log tree commit diff stats
path: root/themes/original_bright
blob: 92f139e3c5ec0745803e47b3aff9b9d5166b5f35 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[colours]
bkgnd=default
titlebar=blue
titlebar.text=bold_white
titlebar.brackets=bold_cyan
titlebar.unencrypted=bold_red
titlebar.encrypted=bold_white
titlebar.untrusted=bold_yellow
titlebar.trusted=bold_white
titlebar.online=bold_white
titlebar.offline=bold_white
titlebar.away=bold_white
titlebar.chat=bold_white
titlebar.dnd=bold_white
titlebar.xa=bold_white
statusbar=blue
statusbar.text=bold_white
statusbar.brackets=bold_cyan
statusbar.active=bold_cyan
statusbar.new=bold_white
main.text=bold_white
main.text.me=bold_white
main.text.them=bold_white
main.splash=bold_cyan
main.time=bold_white
input.text=bold_white
subscribed=bold_green
unsubscribed=bold_red
otr.started.trusted=bold_green
otr.started.untrusted=bold_yellow
otr.ended=bold_red
otr.trusted=bold_green
otr.untrusted=bold_yellow
online=bold_green
away=bold_cyan
chat=bold_green
dnd=bold_red
xa=bold_cyan
offline=bold_red
incoming=bold_yellow
mention=bold_yellow
trigger=bold_yellow
typing=bold_yellow
gone=bold_yellow
error=bold_red
roominfo=bold_yellow
roommention=bold_yellow
roommention.term=bold_yellow
roomtrigger=bold_yellow
roomtrigger.term=bold_yellow
me=bold_yellow
them=bold_green
roster.header=bold_yellow
roster.chat=bold_green
roster.online=bold_green
roster.away=bold_cyan
roster.xa=bold_cyan
roster.dnd=bold_red
roster.offline=bold_red
roster.chat.active=bold_green
roster.online.active=bold_green
roster.away.active=bold_cyan
roster.xa.active=bold_cyan
roster.dnd.active=bold_red
roster.offline.active=bold_red
roster.chat.unread=bold_green
roster.online.unread=bold_green
roster.away.unread=bold_cyan
roster.xa.unread=bold_cyan
roster.dnd.unread=bold_red
roster.offline.unread=bold_red
roster.room=bold_green
roster.room.unread=bold_green
roster.room.mention=bold_green
roster.room.trigger=bold_green
occupants.header=bold_yellow
receipt.sent=bold_red
121' href='#n121'>121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
                   
                   
                      
                   























































                                                                            























































































                                                       
                                
 
                                




                                       







                                    
 
#include <stdlib.h>
#include <string.h>
#include <head-unit.h>
#include "common.h"

void replace_one_substr(void)
{
    char *string = "it is a string";
    char *sub = "is";
    char *new = "was";

    char *result = str_replace(string, sub, new);

    assert_string_equals("it was a string", result);
}

void replace_one_substr_beginning(void)
{
    char *string = "it is a string";
    char *sub = "it";
    char *new = "that";

    char *result = str_replace(string, sub, new);

    assert_string_equals("that is a string", result);
}

void replace_one_substr_end(void)
{
    char *string = "it is a string";
    char *sub = "string";
    char *new = "thing";

    char *result = str_replace(string, sub, new);

    assert_string_equals("it is a thing", result);
}

void replace_two_substr(void)
{
    char *string = "it is a is string";
    char *sub = "is";
    char *new = "was";

    char *result = str_replace(string, sub, new);

    assert_string_equals("it was a was string", result);
}

void replace_char(void)
{
    char *string = "some & a thing & something else";
    char *sub = "&";
    char *new = "&amp;";

    char *result = str_replace(string, sub, new);

    assert_string_equals("some &amp; a thing &amp; something else", result);
}

void replace_when_none(void)
{
    char *string = "its another string";
    char *sub = "haha";
    char *new = "replaced";

    char *result = str_replace(string, sub, new);

    assert_string_equals("its another string", result);
}

void replace_when_match(void)
{
    char *string = "hello";
    char *sub = "hello";
    char *new = "goodbye";

    char *result = str_replace(string, sub, new);

    assert_string_equals("goodbye", result);
}

void replace_when_string_empty(void)
{
    char *string = "";
    char *sub = "hello";
    char *new = "goodbye";

    char *result = str_replace(string, sub, new);

    assert_string_equals("", result);
}

void replace_when_string_null(void)
{
    char *string = NULL;
    char *sub = "hello";
    char *new = "goodbye";

    char *result = str_replace(string, sub, new);

    assert_is_null(result);
}

void replace_when_sub_empty(void)
{
    char *string = "hello";
    char *sub = "";
    char *new = "goodbye";

    char *result = str_replace(string, sub, new);

    assert_string_equals("hello", result);
}

void replace_when_sub_null(void)
{
    char *string = "hello";
    char *sub = NULL;
    char *new = "goodbye";

    char *result = str_replace(string, sub, new);

    assert_string_equals("hello", result);
}

void replace_when_new_empty(void)
{
    char *string = "hello";
    char *sub = "hello";
    char *new = "";

    char *result = str_replace(string, sub, new);

    assert_string_equals("", result);
}

void replace_when_new_null(void)
{
    char *string = "hello";
    char *sub = "hello";
    char *new = NULL;

    char *result = str_replace(string, sub, new);

    assert_string_equals("hello", result);
}

void register_common_tests(void)
{
    TEST_MODULE("common tests");
    TEST(replace_one_substr);
    TEST(replace_one_substr_beginning);
    TEST(replace_one_substr_end);
    TEST(replace_two_substr);
    TEST(replace_char);
    TEST(replace_when_none);
    TEST(replace_when_match);
    TEST(replace_when_string_empty);
    TEST(replace_when_string_null);
    TEST(replace_when_sub_empty);
    TEST(replace_when_sub_null);
    TEST(replace_when_new_empty);
    TEST(replace_when_new_null);
}