blob: 08a4d0f2ed157fd69c166fdfdbc059a5a874ebcb [file] [log] [blame]
Elliott Hughese7d185f2018-06-27 13:30:02 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <sys/un.h>
18
19#include <string.h>
20#include <gtest/gtest.h>
21
22TEST(sys_un, SUN_LEN_macro) {
23 sockaddr_un sun = {};
24 sun.sun_family = 1;
25 strcpy(sun.sun_path, "hello");
26 ASSERT_EQ(2U + strlen("hello"), SUN_LEN(&sun));
27}