~ubuntu-branches/debian/sid/ofono/sid

« back to all changes in this revision

Viewing changes to unit/test-common.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Salomon
  • Date: 2009-11-02 18:46:37 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091102184637-rh8ik6v1lcdgdh10
Tags: 0.9-1
* New upstream release.
* Since it runs w/out it, change the udev Depends to a Recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        }
143
143
}
144
144
 
 
145
static const char *valid_apns[] = {
 
146
        "wap.cingular",
 
147
        "vodafone.co.uk",
 
148
        "vodafone.com",
 
149
        NULL
 
150
};
 
151
 
 
152
static const char *invalid_apns[] = {
 
153
        ".",
 
154
        "..",
 
155
        "f..f",
 
156
        "foo.bar.#",
 
157
        "",
 
158
        NULL
 
159
};
 
160
 
 
161
static void test_apn()
 
162
{
 
163
        int i;
 
164
        gboolean res;
 
165
 
 
166
        for (i = 0; valid_apns[i]; i++) {
 
167
                if (g_test_verbose())
 
168
                        g_print("Test Valid:%s\n", valid_apns[i]);
 
169
 
 
170
                res = is_valid_apn(valid_apns[i]);
 
171
 
 
172
                g_assert(res == TRUE);
 
173
        }
 
174
 
 
175
        for (i = 0; invalid_apns[i]; i++) {
 
176
                if (g_test_verbose())
 
177
                        g_print("Test Invalid:%s\n", invalid_apns[i]);
 
178
 
 
179
                res = is_valid_apn(invalid_apns[i]);
 
180
 
 
181
                g_assert(res == FALSE);
 
182
        }
 
183
}
 
184
 
145
185
int main(int argc, char **argv)
146
186
{
147
187
        g_test_init(&argc, &argv, NULL);
148
188
 
149
189
        g_test_add_func("/testutil/Invalid", test_invalid);
150
190
        g_test_add_func("/testutil/Valid", test_valid);
 
191
        g_test_add_func("/testutil/APN", test_apn);
151
192
 
152
193
        return g_test_run();
153
194
}