summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-18 00:14:50 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-07-18 00:14:50 +0200
commit6e46cff9b27df699a1f78442606cbd09aed53461 (patch)
tree5bf35c6deefe6bcaeca33b371719f570a0b1147d /tests
parentMerge "applypatch: Consolidate CacheSizeCheck() and MakeFreeSpaceOnCache()." am: 624b6b6cd5 am: 603b7ed470 (diff)
parentMerge "Fix the arguments passed to getopt_long(3)." am: 29932e7bcc (diff)
downloadandroid_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.gz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.bz2
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.lz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.xz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.zst
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/sysutil_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/sysutil_test.cpp b/tests/unit/sysutil_test.cpp
index 19fa4c59e..de8ff7065 100644
--- a/tests/unit/sysutil_test.cpp
+++ b/tests/unit/sysutil_test.cpp
@@ -127,3 +127,13 @@ TEST(SysUtilTest, MapFileBlockMapInvalidBlockMap) {
ASSERT_TRUE(android::base::WriteStringToFile("/doesntexist\n4096 4096\n1\n0 1\n", temp_file.path));
ASSERT_FALSE(mapping.MapFile(filename));
}
+
+TEST(SysUtilTest, StringVectorToNullTerminatedArray) {
+ std::vector<std::string> args{ "foo", "bar", "baz" };
+ auto args_with_nullptr = StringVectorToNullTerminatedArray(args);
+ ASSERT_EQ(4, args_with_nullptr.size());
+ ASSERT_STREQ("foo", args_with_nullptr[0]);
+ ASSERT_STREQ("bar", args_with_nullptr[1]);
+ ASSERT_STREQ("baz", args_with_nullptr[2]);
+ ASSERT_EQ(nullptr, args_with_nullptr[3]);
+}