// File: /workspace/github_c_makefile_star2_O3/theck01[P]offbrand_lib/src/tests/obstring_test.c
// Function: main
int main (){

  obstring *str1, *str2, *str3, *null_str;
  obvector *tokens;
  const char *contents;

  str1 = obstring_new("Hello, World!");

  /* Test obstring_new and obstring_cstring */
  contents = obstring_cstring(str1);
  assert(strcmp(contents, "Hello, World!") == 0);


  /* Test obstring_copy_substring and obstring_length */
  str2 = obstring_copy_substring(str1, 0, 5);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello") == 0);

  ob_release((obj *)str2);

  str2 = obstring_copy_substring(str1, -15, 7);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello") == 0);

  ob_release((obj *)str2);

  str2 = obstring_copy_substring(str1, 0, obstring_length(str1));
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello, World!") == 0);

  ob_release((obj *)str2);

  null_str = obstring_copy_substring(str1, 20, 2);
  assert(obstring_length(null_str) == 0);

  /* Test obstring_char_at_index */
  assert(obstring_char_at_index(str1, 0) == 'H');
  assert(obstring_char_at_index(str1, -5) == 'o');
  assert(obstring_char_at_index(str1, -20) == '\0');
  assert(obstring_char_at_index(str1, 20) == '\0');
  assert(obstring_char_at_index(null_str, 0) == '\0');

  /* Test String Concatenation */
  str2 = obstring_new(" And hello again!");
  str3 = obstring_concat(str1, str2);
  contents = obstring_cstring(str3);
  assert(strcmp(contents, "Hello, World! And hello again!") == 0);

  ob_release((obj *)str2);

  str2 = obstring_concat(null_str, str1);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello, World!") == 0);

  /* Test String Comparision */
  assert(ob_compare((obj *)str1, (obj *)str2) == OB_EQUAL_TO);
  assert(ob_compare((obj *)str1, (obj *)str3) == OB_LESS_THAN);
  assert(ob_compare((obj *)str1, (obj *)null_str) == OB_GREATER_THAN);

  ob_release((obj *)str2);
  ob_release((obj *)str3);

  /* Test String Splits */
  str2 = obstring_new("Testing string split   into#!many");
  tokens = obstring_split(str2, " ");
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 0)), "Testing")
         == 0);
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 3)),
                           "into#!many") == 0);

  ob_release((obj *)tokens);

  tokens = obstring_split(str2, "#!");
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 0)),
                           "Testing string split   into") == 0);
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 1)), "many")
         == 0);

  ob_release((obj *)tokens);

  /* Test String Search */

  assert(obstring_find_substring(str2, "Testing") != 0);
  assert(obstring_find_substring(str2, "#!many") != 0);
  assert(obstring_find_substring(str2, "Hello World") == 0);

  /* Test Regex Match */
  str3 = obstring_match_regex(str1, "[Hh]el{1,2}.");
  assert(strcmp(obstring_cstring(str3), "Hello") == 0);
  ob_release((obj *)str3);

  str3 = obstring_match_regex(str2, " *into[#!]{2,2}.*$");
  assert(strcmp(obstring_cstring(str3), "   into#!many") == 0);

  ob_release((obj *)str3);
  ob_release((obj *)str2);
  ob_release((obj *)str1);
  ob_release((obj *)null_str);

  /* TESTS COMPLETE */
  printf("obstring: TESTS PASSED\n");

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2c79(%rip), %r14      # 0x4004
movq %r14, %rdi
callq 0x1a6c
movq %rax, %rbx
movq %rax, %rdi
callq 0x1dca
movq %rax, %rdi
movq %r14, %rsi
callq 0x10f0
testl %eax, %eax
jne 0x1782
movq %rbx, %rdi
xorl %esi, %esi
movl $0x5, %edx
callq 0x1b93
movq %rax, %r14
movq %rax, %rdi
callq 0x1dca
leaq 0x2c8c(%rip), %rsi      # 0x405e
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x17a1
movq %r14, %rdi
callq 0x3112
movq %rbx, %rdi
movq $-0xf, %rsi
movl $0x7, %edx
callq 0x1b93
movq %rax, %r14
movq %rax, %rdi
callq 0x1dca
leaq 0x2c4e(%rip), %rsi      # 0x405e
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x17c0
movq %r14, %rdi
callq 0x3112
movq %rbx, %rdi
callq 0x1c81
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x1b93
movq %rax, %r14
movq %rax, %rdi
callq 0x1dca
leaq 0x2bb6(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x17df
movq %r14, %rdi
callq 0x3112
movl $0x14, %esi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1b93
movq %rax, %r14
movq %rax, %rdi
callq 0x1c81
testl %eax, %eax
jne 0x17fe
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1caa
cmpb $0x48, %al
jne 0x181d
movq %rbx, %rdi
movq $-0x5, %rsi
callq 0x1caa
cmpb $0x6f, %al
jne 0x183c
movq %rbx, %rdi
movq $-0x14, %rsi
callq 0x1caa
testb %al, %al
jne 0x185b
movl $0x14, %esi
movq %rbx, %rdi
callq 0x1caa
testb %al, %al
jne 0x187a
movq %r14, %rdi
xorl %esi, %esi
callq 0x1caa
testb %al, %al
jne 0x1899
leaq 0x2c84(%rip), %rdi      # 0x417d
callq 0x1a6c
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1cee
movq %rax, %r15
movq %rax, %rdi
callq 0x1dca
leaq 0x2c52(%rip), %rsi      # 0x4170
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x18b8
movq %r12, %rdi
callq 0x3112
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1cee
movq %rax, %r12
movq %rax, %rdi
callq 0x1dca
leaq 0x2ab1(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x18d7
movq %rbx, %rdi
movq %r12, %rsi
callq 0x308f
testb %al, %al
jne 0x18f6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x308f
cmpb $-0x1, %al
jne 0x1915
movq %rbx, %rdi
movq %r14, %rsi
callq 0x308f
cmpb $0x1, %al
jne 0x1934
movq %r12, %rdi
callq 0x3112
movq %r15, %rdi
callq 0x3112
leaq 0x2cb9(%rip), %rdi      # 0x426c
callq 0x1a6c
movq %rax, %r15
leaq 0x2ccc(%rip), %rsi      # 0x428e
movq %rax, %rdi
callq 0x1df4
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
callq 0x27c7
movq %rax, %rdi
callq 0x1dca
leaq 0x2caa(%rip), %rsi      # 0x4290
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1953
movl $0x3, %esi
movq %r12, %rdi
callq 0x27c7
movq %rax, %rdi
callq 0x1dca
leaq 0x2c71(%rip), %rsi      # 0x4283
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1972
movq %r12, %rdi
callq 0x3112
leaq 0x2d18(%rip), %rsi      # 0x4349
movq %r15, %rdi
callq 0x1df4
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
callq 0x27c7
movq %rax, %rdi
callq 0x1dca
leaq 0x2cf7(%rip), %rsi      # 0x434c
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1991
movl $0x1, %esi
movq %r12, %rdi
callq 0x27c7
movq %rax, %rdi
callq 0x1dca
leaq 0x2c08(%rip), %rsi      # 0x4289
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x19b0
movq %r12, %rdi
callq 0x3112
leaq 0x2bf0(%rip), %rsi      # 0x4290
movq %r15, %rdi
callq 0x1f5e
testb %al, %al
je 0x19cf
leaq 0x2bd0(%rip), %rsi      # 0x4287
movq %r15, %rdi
callq 0x1f5e
testb %al, %al
je 0x19ee
leaq 0x2db4(%rip), %rsi      # 0x4482
movq %r15, %rdi
callq 0x1f5e
testb %al, %al
jne 0x1a0d
leaq 0x2ddb(%rip), %rsi      # 0x44c0
movq %rbx, %rdi
callq 0x1ffb
movq %rax, %r12
movq %rax, %rdi
callq 0x1dca
leaq 0x295f(%rip), %rsi      # 0x405e
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1a2c
movq %r12, %rdi
callq 0x3112
leaq 0x2ddc(%rip), %rsi      # 0x44fa
movq %r15, %rdi
callq 0x1ffb
movq %rax, %r12
movq %rax, %rdi
callq 0x1dca
leaq 0x2b48(%rip), %rsi      # 0x4280
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1a4b
movq %r12, %rdi
callq 0x3112
movq %r15, %rdi
callq 0x3112
movq %rbx, %rdi
callq 0x3112
movq %r14, %rdi
callq 0x3112
leaq 0x2dd3(%rip), %rdi      # 0x4542
callq 0x1070
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2889(%rip), %rdi      # 0x4012
leaq 0x28a9(%rip), %rsi      # 0x4039
leaq 0x28bc(%rip), %rcx      # 0x4053
movl $0x17, %edx
callq 0x10a0
leaq 0x28bc(%rip), %rdi      # 0x4064
leaq 0x288a(%rip), %rsi      # 0x4039
leaq 0x289d(%rip), %rcx      # 0x4053
movl $0x1d, %edx
callq 0x10a0
leaq 0x289d(%rip), %rdi      # 0x4064
leaq 0x286b(%rip), %rsi      # 0x4039
leaq 0x287e(%rip), %rcx      # 0x4053
movl $0x23, %edx
callq 0x10a0
leaq 0x282c(%rip), %rdi      # 0x4012
leaq 0x284c(%rip), %rsi      # 0x4039
leaq 0x285f(%rip), %rcx      # 0x4053
movl $0x29, %edx
callq 0x10a0
leaq 0x287e(%rip), %rdi      # 0x4083
leaq 0x282d(%rip), %rsi      # 0x4039
leaq 0x2840(%rip), %rcx      # 0x4053
movl $0x2e, %edx
callq 0x10a0
leaq 0x287e(%rip), %rdi      # 0x40a2
leaq 0x280e(%rip), %rsi      # 0x4039
leaq 0x2821(%rip), %rcx      # 0x4053
movl $0x31, %edx
callq 0x10a0
leaq 0x2886(%rip), %rdi      # 0x40c9
leaq 0x27ef(%rip), %rsi      # 0x4039
leaq 0x2802(%rip), %rcx      # 0x4053
movl $0x32, %edx
callq 0x10a0
leaq 0x288f(%rip), %rdi      # 0x40f1
leaq 0x27d0(%rip), %rsi      # 0x4039
leaq 0x27e3(%rip), %rcx      # 0x4053
movl $0x33, %edx
callq 0x10a0
leaq 0x289a(%rip), %rdi      # 0x411b
leaq 0x27b1(%rip), %rsi      # 0x4039
leaq 0x27c4(%rip), %rcx      # 0x4053
movl $0x34, %edx
callq 0x10a0
leaq 0x28a4(%rip), %rdi      # 0x4144
leaq 0x2792(%rip), %rsi      # 0x4039
leaq 0x27a5(%rip), %rcx      # 0x4053
movl $0x35, %edx
callq 0x10a0
leaq 0x28d0(%rip), %rdi      # 0x418f
leaq 0x2773(%rip), %rsi      # 0x4039
leaq 0x2786(%rip), %rcx      # 0x4053
movl $0x3b, %edx
callq 0x10a0
leaq 0x2734(%rip), %rdi      # 0x4012
leaq 0x2754(%rip), %rsi      # 0x4039
leaq 0x2767(%rip), %rcx      # 0x4053
movl $0x41, %edx
callq 0x10a0
leaq 0x28ca(%rip), %rdi      # 0x41c7
leaq 0x2735(%rip), %rsi      # 0x4039
leaq 0x2748(%rip), %rcx      # 0x4053
movl $0x44, %edx
callq 0x10a0
leaq 0x28df(%rip), %rdi      # 0x41fb
leaq 0x2716(%rip), %rsi      # 0x4039
leaq 0x2729(%rip), %rcx      # 0x4053
movl $0x45, %edx
callq 0x10a0
leaq 0x28f5(%rip), %rdi      # 0x4230
leaq 0x26f7(%rip), %rsi      # 0x4039
leaq 0x270a(%rip), %rcx      # 0x4053
movl $0x46, %edx
callq 0x10a0
leaq 0x293e(%rip), %rdi      # 0x4298
leaq 0x26d8(%rip), %rsi      # 0x4039
leaq 0x26eb(%rip), %rcx      # 0x4053
movl $0x4f, %edx
callq 0x10a0
leaq 0x2976(%rip), %rdi      # 0x42ef
leaq 0x26b9(%rip), %rsi      # 0x4039
leaq 0x26cc(%rip), %rcx      # 0x4053
movl $0x51, %edx
callq 0x10a0
leaq 0x29d0(%rip), %rdi      # 0x4368
leaq 0x269a(%rip), %rsi      # 0x4039
leaq 0x26ad(%rip), %rcx      # 0x4053
movl $0x57, %edx
callq 0x10a0
leaq 0x2a1c(%rip), %rdi      # 0x43d3
leaq 0x267b(%rip), %rsi      # 0x4039
leaq 0x268e(%rip), %rcx      # 0x4053
movl $0x59, %edx
callq 0x10a0
leaq 0x2a51(%rip), %rdi      # 0x4427
leaq 0x265c(%rip), %rsi      # 0x4039
leaq 0x266f(%rip), %rcx      # 0x4053
movl $0x5f, %edx
callq 0x10a0
leaq 0x2a60(%rip), %rdi      # 0x4455
leaq 0x263d(%rip), %rsi      # 0x4039
leaq 0x2650(%rip), %rcx      # 0x4053
movl $0x60, %edx
callq 0x10a0
leaq 0x2a7a(%rip), %rdi      # 0x448e
leaq 0x261e(%rip), %rsi      # 0x4039
leaq 0x2631(%rip), %rcx      # 0x4053
movl $0x61, %edx
callq 0x10a0
leaq 0x2a9a(%rip), %rdi      # 0x44cd
leaq 0x25ff(%rip), %rsi      # 0x4039
leaq 0x2612(%rip), %rcx      # 0x4053
movl $0x65, %edx
callq 0x10a0
leaq 0x2abb(%rip), %rdi      # 0x450d
leaq 0x25e0(%rip), %rsi      # 0x4039
leaq 0x25f3(%rip), %rcx      # 0x4053
movl $0x69, %edx
callq 0x10a0
nop