// File: /workspace/github_c_makefile_star2_O3/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
movl $0x18, %ebp
leaq 0x33355(%rip), %rbx     # 0x715c0
leaq 0x4ac(%rsp), %r14
leaq 0x220(%rsp), %r15
leaq 0x20(%rsp), %r12
movq -0x10(%rbp,%rbx), %rsi
movl -0x18(%rbp,%rbx), %r13d
movq %r14, %rdi
movl %r13d, %edx
callq 0x41ff4
movq -0x8(%rbp,%rbx), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x41ff4
movq %r14, %rdi
movq %r15, %rsi
callq 0x42283
movq %r12, %rdi
movq %r14, %rsi
callq 0x42376
movq (%rbp,%rbx), %rcx
leaq 0x10(%rsp), %rdi
leaq 0x17f6d(%rip), %rsi     # 0x56239
leaq 0x197e2(%rip), %rdx     # 0x57ab5
movq %r12, %r8
callq 0x14ffa
cmpb $0x0, 0x10(%rsp)
je 0x3e300
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2c37a
addq $0x20, %rbp
cmpq $0x1b8, %rbp            # imm = 0x1B8
jne 0x3e280
jmp 0x3e380
movq %rsp, %rdi
callq 0x12e46
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x3e317
movq (%rax), %r8
jmp 0x3e31e
leaq 0x19ba9(%rip), %r8      # 0x57ec7
leaq 0x17dc3(%rip), %rdx     # 0x560e8
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x6d, %ecx
callq 0x10b64
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x10c00
leaq 0x8(%rsp), %rdi
callq 0x10bd0
cmpq $0x0, (%rsp)
je 0x3e374
movl $0x1, %edi
callq 0x10b61
testb %al, %al
je 0x3e374
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3e374
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2c37a
addq $0x738, %rsp            # imm = 0x738
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3e3c7
jmp 0x3e3c7
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x10bd0
jmp 0x3e3a8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x31a70
jmp 0x3e3b5
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x31a82
movq %rbx, %rdi
callq 0xcbb0
movq %rax, %rdi
callq 0x287ef
nop