// File: /workspace/github_c_makefile_star2_O1/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 0x33813(%rip), %rbx     # 0x725c0
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 0x42eb0
movq -0x8(%rbp,%rbx), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x42eb0
movq %r14, %rdi
movq %r15, %rsi
callq 0x43142
movq %r12, %rdi
movq %r14, %rsi
callq 0x4322e
movq (%rbp,%rbx), %rcx
leaq 0x10(%rsp), %rdi
leaq 0x183fb(%rip), %rsi     # 0x57209
leaq 0x19c2c(%rip), %rdx     # 0x58a41
movq %r12, %r8
callq 0x150d6
cmpb $0x0, 0x10(%rsp)
je 0x3ee42
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2c81c
addq $0x20, %rbp
cmpq $0x1b8, %rbp            # imm = 0x1B8
jne 0x3edc2
jmp 0x3eeca
movq %rsp, %rdi
callq 0x12eee
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x3ee59
movq (%rax), %r8
jmp 0x3ee60
leaq 0x19ff3(%rip), %r8      # 0x58e53
leaq 0x18251(%rip), %rdx     # 0x570b8
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x6d, %ecx
callq 0x10bb8
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x10c56
leaq 0x8(%rsp), %rdi
callq 0x10c24
cmpq $0x0, (%rsp)
je 0x3eebe
movl $0x1, %edi
callq 0x10bb4
testb %al, %al
je 0x3eeb6
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3eeb6
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rsp)
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2c81c
addq $0x738, %rsp            # imm = 0x738
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ef11
jmp 0x3ef11
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x10c24
jmp 0x3eef2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x31faa
jmp 0x3eeff
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x31fbc
movq %rbx, %rdi
callq 0xcbb0
movq %rax, %rdi
callq 0x28baf
nop