// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7a0, %rsp            # imm = 0x7A0
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0xd, -0x10(%rbp)
jae 0x671a9
movq -0x10(%rbp), %rax
shlq $0x5, %rax
leaq 0x5958f(%rip), %rcx     # 0xc0540
movq %rcx, -0x780(%rbp)
movq 0x8(%rax,%rcx), %rsi
movl (%rax,%rcx), %edx
leaq -0x29c(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x6e7a0
movq -0x780(%rbp), %rcx
movq -0x10(%rbp), %rax
shlq $0x5, %rax
movq 0x10(%rax,%rcx), %rsi
movl (%rax,%rcx), %edx
leaq -0x528(%rbp), %rdi
movq %rdi, -0x790(%rbp)
callq 0x6e7a0
movq -0x790(%rbp), %rsi
movq -0x788(%rbp), %rdi
callq 0x6ed40
movq -0x788(%rbp), %rsi
leaq -0x730(%rbp), %rdi
movq %rdi, -0x778(%rbp)
callq 0x6eef0
movq -0x780(%rbp), %rcx
movq -0x778(%rbp), %r8
movq -0x10(%rbp), %rax
shlq $0x5, %rax
movq 0x18(%rax,%rcx), %rcx
leaq 0x2777d(%rip), %rsi     # 0x8e7c9
leaq 0x2934c(%rip), %rdx     # 0x9039f
leaq -0x740(%rbp), %rdi
movq %rdi, -0x770(%rbp)
callq 0x19e10
movq -0x770(%rbp), %rdi
callq 0x31090
movb %al, -0x765(%rbp)
jmp 0x6707a
movb -0x765(%rbp), %al
testb $0x1, %al
jne 0x67086
jmp 0x670a2
jmp 0x67164
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x748(%rbp)
movl %eax, -0x74c(%rbp)
jmp 0x6719b
leaq -0x758(%rbp), %rdi
callq 0x16d70
jmp 0x670b0
leaq -0x740(%rbp), %rdi
callq 0x310b0
movq %rax, -0x798(%rbp)
jmp 0x670c5
movq -0x798(%rbp), %r8
leaq 0x275a5(%rip), %rdx     # 0x8e678
leaq -0x760(%rbp), %rdi
movl $0x2, %esi
movl $0x6d, %ecx
callq 0x13fa0
jmp 0x670eb
leaq -0x760(%rbp), %rdi
leaq -0x758(%rbp), %rsi
callq 0x14060
jmp 0x67100
leaq -0x760(%rbp), %rdi
callq 0x14020
leaq -0x758(%rbp), %rdi
callq 0x31070
movl $0x1, -0x764(%rbp)
jmp 0x6716e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x748(%rbp)
movl %eax, -0x74c(%rbp)
jmp 0x67156
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x748(%rbp)
movl %eax, -0x74c(%rbp)
leaq -0x760(%rbp), %rdi
callq 0x14020
leaq -0x758(%rbp), %rdi
callq 0x31070
jmp 0x6719b
movl $0x0, -0x764(%rbp)
leaq -0x740(%rbp), %rdi
callq 0x30d20
movl -0x764(%rbp), %eax
testl %eax, %eax
je 0x67188
jmp 0x67186
jmp 0x671a9
jmp 0x6718a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x66f97
leaq -0x740(%rbp), %rdi
callq 0x30d20
jmp 0x671b2
addq $0x7a0, %rsp            # imm = 0x7A0
popq %rbp
retq
movq -0x748(%rbp), %rdi
callq 0xee80
nop