// File: ef-gy[P]libefgy/src/test-case/unit.cpp
// Function: testUnitMetric(std::ostream&)
bool testUnitMetric(std::ostream &log) {
  metre<fraction>::unit one(fraction(1));

  if (one != fraction(1)) {
    log << "variable did not have the expected value after initialisation\n";
    return false;
  }

  metre<fraction>::milli onem = one;

  if (onem == one) {
    log << "value in ::milli should not have been the same as the unit value\n";
    return false;
  }

  if (onem < one) {
    log << "value in ::milli should be larger than the unit value\n";
    return false;
  }

  metre<fraction>::unit oneu = onem;

  if (oneu != one) {
    log << "value before and after converting should have been the same\n";
    return false;
  }

  metre<fraction>::micro onemi = onem;

  if (onemi == onem) {
    log << "value in ::micro should not have been the same as the ::milli "
           "value\n";
    return false;
  }

  if (onemi < onem) {
    log << "value in ::micro should be larger than the ::milli value\n";
    return false;
  }

  if (metre<fraction>::milli(onemi) != onem) {
    log << "value in ::micro should be the same in ::milli after conversion\n";
    return false;
  }

  if (onem != metre<fraction>::milli(fraction(1000))) {
    log << "value should have been precisely 1000\n";
    return false;
  }

  if (onemi != metre<fraction>::micro(fraction(1000000))) {
    log << "value should have been precisely 1000000\n";
    return false;
  }

  if (metre<fraction>::milli(onemi) != metre<fraction>::milli(fraction(1000))) {
    log << "value should have been precisely 1000\n";
    return false;
  }

  metre<fraction>::mega oneM = one;

  if (oneM == one) {
    log << "value in ::mega should not have been the same as the unit value\n";
    return false;
  }

  if (oneM > one) {
    log << "value in ::mega should be smaller than the unit value\n";
    return false;
  }

  if (oneM != metre<fraction>::mega(fraction(1, 1000000))) {
    log << "value should have been precisely 1/1000000\n";
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x6fb0
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6fe0
leaq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0x6fb0
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x7010
testb $0x1, %al
jne 0x5d8b
jmp 0x5da4
movq -0x10(%rbp), %rdi
leaq 0x2f430(%rip), %rsi     # 0x351c6
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x50(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7040
leaq -0x50(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x70a0
testb $0x1, %al
jne 0x5dc4
jmp 0x5ddd
movq -0x10(%rbp), %rdi
leaq 0x2f436(%rip), %rsi     # 0x35205
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x50(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x70f0
testb $0x1, %al
jne 0x5df0
jmp 0x5e09
movq -0x10(%rbp), %rdi
leaq 0x2f44c(%rip), %rsi     # 0x35247
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7120
leaq -0x60(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7180
testb $0x1, %al
jne 0x5e29
jmp 0x5e42
movq -0x10(%rbp), %rdi
leaq 0x2f44a(%rip), %rsi     # 0x3527e
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x71b0
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x70a0
testb $0x1, %al
jne 0x5e62
jmp 0x5e7b
movq -0x10(%rbp), %rdi
leaq 0x2f44e(%rip), %rsi     # 0x352bb
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7210
testb $0x1, %al
jne 0x5e8e
jmp 0x5ea7
movq -0x10(%rbp), %rdi
leaq 0x2f467(%rip), %rsi     # 0x35300
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7270
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7240
testb $0x1, %al
jne 0x5ec7
jmp 0x5ee0
movq -0x10(%rbp), %rdi
leaq 0x2f468(%rip), %rsi     # 0x3533a
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0xa0(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x6fb0
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x72d0
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7240
testb $0x1, %al
jne 0x5f1a
jmp 0x5f33
movq -0x10(%rbp), %rdi
leaq 0x2f456(%rip), %rsi     # 0x3537b
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0xc0(%rbp), %rdi
movl $0xf4240, %esi          # imm = 0xF4240
callq 0x6fb0
leaq -0xb0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x7330
leaq -0x70(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x7300
testb $0x1, %al
jne 0x5f6d
jmp 0x5f86
movq -0x10(%rbp), %rdi
leaq 0x2f42a(%rip), %rsi     # 0x353a2
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0xd0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7270
leaq -0xf0(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x6fb0
leaq -0xe0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x72d0
leaq -0xd0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x7240
testb $0x1, %al
jne 0x5fd3
jmp 0x5fec
movq -0x10(%rbp), %rdi
leaq 0x2f39d(%rip), %rsi     # 0x3537b
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x100(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7360
leaq -0x100(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x70a0
testb $0x1, %al
jne 0x6012
jmp 0x602b
movq -0x10(%rbp), %rdi
leaq 0x2f3af(%rip), %rsi     # 0x353cc
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x100(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x73c0
testb $0x1, %al
jne 0x6041
jmp 0x6057
movq -0x10(%rbp), %rdi
leaq 0x2f3c1(%rip), %rsi     # 0x3540d
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
leaq -0x120(%rbp), %rdi
movl $0x1, %esi
movl $0xf4240, %edx          # imm = 0xF4240
callq 0x7480
leaq -0x110(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x74c0
leaq -0x100(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x7450
testb $0x1, %al
jne 0x6099
jmp 0x60af
movq -0x10(%rbp), %rdi
leaq 0x2f3a0(%rip), %rsi     # 0x35444
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x60b3
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)