diff options
author | Elliott Hughes <enh@google.com> | 2015-04-02 13:36:54 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-04-02 14:25:55 -0700 |
commit | af98efbd15878fbd97fd3ef3c413d739ed9589e9 (patch) | |
tree | f01619eb6b1f5475cdb1f31c8119af854531e244 /libcutils/str_parms.c | |
parent | d8fb29b0c09de25c416141a4bb150cc7db9f28ca (diff) | |
download | system_core-af98efbd15878fbd97fd3ef3c413d739ed9589e9.zip system_core-af98efbd15878fbd97fd3ef3c413d739ed9589e9.tar.gz system_core-af98efbd15878fbd97fd3ef3c413d739ed9589e9.tar.bz2 |
Move all libcutils tests into the gtests.
This also fixes the bug where we were always testing against the fake
strlcpy we provide for glibc/Windows rather than the Android one.
This also removes some unnecessary library dependencies.
This also builds all the cutils tests for the host (static and dynamic).
Change-Id: Icd129d5b025c0ca801be5acf31a54ecd88608df9
Diffstat (limited to 'libcutils/str_parms.c')
-rw-r--r-- | libcutils/str_parms.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c index dfe8c4b..924289a 100644 --- a/libcutils/str_parms.c +++ b/libcutils/str_parms.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2013 The Android Open Source Project + * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -357,51 +357,3 @@ void str_parms_dump(struct str_parms *str_parms) { hashmapForEach(str_parms->map, dump_entry, str_parms); } - -#ifdef TEST_STR_PARMS -static void test_str_parms_str(const char *str) -{ - struct str_parms *str_parms; - char *out_str; - - str_parms = str_parms_create_str(str); - str_parms_add_str(str_parms, "dude", "woah"); - str_parms_add_str(str_parms, "dude", "woah"); - str_parms_del(str_parms, "dude"); - str_parms_dump(str_parms); - out_str = str_parms_to_str(str_parms); - str_parms_destroy(str_parms); - ALOGI("%s: '%s' stringified is '%s'", __func__, str, out_str); - free(out_str); -} - -int main(void) -{ - test_str_parms_str(""); - test_str_parms_str(";"); - test_str_parms_str("="); - test_str_parms_str("=;"); - test_str_parms_str("=bar"); - test_str_parms_str("=bar;"); - test_str_parms_str("foo="); - test_str_parms_str("foo=;"); - test_str_parms_str("foo=bar"); - test_str_parms_str("foo=bar;"); - test_str_parms_str("foo=bar;baz"); - test_str_parms_str("foo=bar;baz="); - test_str_parms_str("foo=bar;baz=bat"); - test_str_parms_str("foo=bar;baz=bat;"); - test_str_parms_str("foo=bar;baz=bat;foo=bar"); - - // hashmapPut reports errors by setting errno to ENOMEM. - // Test that we're not confused by running in an environment where this is already true. - errno = ENOMEM; - test_str_parms_str("foo=bar;baz="); - if (errno != ENOMEM) { - abort(); - } - test_str_parms_str("foo=bar;baz="); - - return 0; -} -#endif |