// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/unittest/test_PathUtil.cpp
// Function: PathUtil_Concat_Test::TestBody()
TEST(PathUtil, Concat)
{
  static const struct
  {
    PathType::Enum  type;
    const char     *a, *b;
    const char     *expected_output;
  }
  test_data[] =
  {
    { PathType::kUnix,    "",                "",                     "" },
    { PathType::kUnix,    "",                "foo.c",                "foo.c" },
    { PathType::kUnix,    "/",               "foo.c",                "/foo.c" },
    { PathType::kUnix,    "/bar",            "foo.c",                "/bar/foo.c" },
    { PathType::kUnix,    "/bar",            "../foo.c",             "/foo.c" },
    { PathType::kUnix,    "/bar",            "../../foo.c",          "/foo.c" },
    { PathType::kUnix,    "/bar",            "/foo.c",               "/foo.c" },
    { PathType::kUnix,    "/a/b/c/d",        "e/f/g.h",              "/a/b/c/d/e/f/g.h" },
    { PathType::kUnix,    "a/b/c/d",         "../..",                "a/b" },
    { PathType::kWindows, "\\foo",           "bar.h",                "\\foo\\bar.h" },
    { PathType::kWindows, "x:\\foo",         "bar.h",                "x:\\foo\\bar.h" },
    { PathType::kWindows, "x:\\foo",         "..\\bar.h",            "x:\\bar.h" },
    { PathType::kWindows, "x:\\foo",         "..\\..\\bar.h",        "x:\\bar.h" },
  };

  for (size_t i = 0; i < ARRAY_SIZE(test_data); ++i)
  {
    PathBuffer a, b;
    PathInit(&a, test_data[i].a, test_data[i].type);
    PathInit(&b, test_data[i].b, test_data[i].type);

    PathConcat(&a, &b);

    char buffer[kMaxPathLength];
    PathFormat(buffer, &a);
    ASSERT_STREQ(test_data[i].expected_output, buffer);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x738, %rsp            # imm = 0x738
pushq $0x18
popq %rbp
leaq 0x36ab9(%rip), %rbx     # 0x68540
leaq 0x4ac(%rsp), %r14
leaq 0x220(%rsp), %r15
leaq 0x20(%rsp), %r12
cmpq $0x1b8, %rbp            # imm = 0x1B8
je 0x31b79
movq -0x10(%rbp,%rbx), %rsi
movl -0x18(%rbp,%rbx), %r13d
movq %r14, %rdi
movl %r13d, %edx
callq 0x351c8
movq -0x8(%rbp,%rbx), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x351c8
movq %r14, %rdi
movq %r15, %rsi
callq 0x35457
movq %r12, %rdi
movq %r14, %rsi
callq 0x3553e
movq (%rbp,%rbx), %rcx
leaq 0x10(%rsp), %rdi
leaq 0x16724(%rip), %rsi     # 0x48219
leaq 0x17f99(%rip), %rdx     # 0x49a95
movq %r12, %r8
callq 0x13723
cmpb $0x0, 0x10(%rsp)
je 0x31b1b
leaq 0x18(%rsp), %rdi
callq 0x2295e
addq $0x20, %rbp
jmp 0x31a9c
leaq 0x8(%rsp), %rdi
callq 0x11c8e
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x31b34
movq (%rax), %r8
jmp 0x31b3b
leaq 0x1836c(%rip), %r8      # 0x49ea7
leaq 0x16586(%rip), %rdx     # 0x480c8
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x6d
popq %rcx
callq 0x104f8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x10576
movq %rsp, %rdi
callq 0x10558
leaq 0x8(%rsp), %rdi
callq 0x1f8e0
leaq 0x18(%rsp), %rdi
callq 0x2295e
addq $0x738, %rsp            # imm = 0x738
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x10558
jmp 0x31b9b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1f8e0
jmp 0x31baa
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2295e
movq %rbx, %rdi
callq 0xdbf0