// File: /workspace/github_cpp_makefile_star2_O2/ashlall[P]StreamStats/Test/BasicStats_test.cpp
// Function: test_Average()
void test_Average()
{
  BasicStats a;
  a.insert(50);
  assert(a.Average()==50); //tests when there is only one number in the stream.       
        
  BasicStats b;
  for (int i=1;i<=100;i++) //tests for ascending number from 1 to 100. 
    b.insert(i);
  assert(b.Average()==50.5);
  
  BasicStats c; // tests with one million items in the stream in descending order 
  for (int i=1000000;i>=1;i--)
    c.insert(i);
  assert(c.Average()==500000.5);
  
  BasicStats d;
  double sum=0;
  int random_num;
  for(int i=0;i<100000;i++)
  {
     random_num=(rand()%1000+250);
     d.insert(random_num); //tests for a randomly generated stream
     sum=sum+random_num;
  }
   assert(d.Average()==sum/100000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
xorps %xmm0, %xmm0
leaq -0xe0(%rbp), %rbx
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
andq $0x0, 0x20(%rbx)
movsd 0x7ac(%rip), %xmm0      # 0x2040
movq %rbx, %rdi
callq 0x1228
cvtsi2sdq 0x20(%rbx), %xmm0
movsd (%rbx), %xmm1
divsd %xmm0, %xmm1
ucomisd 0x78e(%rip), %xmm1      # 0x2040
jne 0x1a18
jp 0x1a18
leaq -0xb0(%rbp), %rbx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rbx)
andq $0x0, 0x20(%rbx)
movapd %xmm0, (%rbx)
movsd 0x731(%rip), %xmm0      # 0x2010
pushq $0x64
popq %r14
subl $0x1, %r14d
jb 0x190a
movq %rbx, %rdi
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x1228
movsd -0x20(%rbp), %xmm0
addsd 0x708(%rip), %xmm0      # 0x2010
jmp 0x18e3
movsd -0xb0(%rbp), %xmm0
cvtsi2sdq -0x90(%rbp), %xmm1
divsd %xmm1, %xmm0
ucomisd 0x721(%rip), %xmm0      # 0x2048
jne 0x1a31
jp 0x1a31
xorpd %xmm0, %xmm0
leaq -0x80(%rbp), %rbx
andq $0x0, 0x20(%rbx)
movapd %xmm0, 0x10(%rbx)
movapd %xmm0, (%rbx)
movl $0xf4240, %eax          # imm = 0xF4240
movl $0xf4240, %r14d         # imm = 0xF4240
subl $0x1, %r14d
jb 0x196b
cvtsi2sd %eax, %xmm0
movq %rbx, %rdi
callq 0x1228
movl %r14d, %eax
jmp 0x1954
movsd -0x80(%rbp), %xmm0
cvtsi2sdq -0x60(%rbp), %xmm1
divsd %xmm1, %xmm0
ucomisd 0x6ce(%rip), %xmm0      # 0x2050
jne 0x1a4a
jp 0x1a4a
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rbx
movapd %xmm0, 0x10(%rbx)
andq $0x0, 0x20(%rbx)
movapd %xmm0, (%rbx)
xorpd %xmm2, %xmm2
movl $0x186a0, %r14d         # imm = 0x186A0
movl $0x3e8, %r15d           # imm = 0x3E8
subl $0x1, %r14d
jb 0x19eb
movsd %xmm2, -0x20(%rbp)
callq 0x1030
cltd
idivl %r15d
addl $0xfa, %edx
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x28(%rbp)
movq %rbx, %rdi
callq 0x1228
movsd -0x20(%rbp), %xmm2
addsd -0x28(%rbp), %xmm2
jmp 0x19b4
movsd -0x50(%rbp), %xmm0
cvtsi2sdq -0x30(%rbp), %xmm1
divsd %xmm1, %xmm0
divsd 0x656(%rip), %xmm2      # 0x2058
ucomisd %xmm2, %xmm0
jne 0x1a63
jp 0x1a63
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6fc(%rip), %rdi       # 0x211b
leaq 0x64d(%rip), %rsi       # 0x2073
leaq 0x6fe(%rip), %rcx       # 0x212b
pushq $0x4b
jmp 0x1a7a
leaq 0x707(%rip), %rdi       # 0x213f
leaq 0x634(%rip), %rsi       # 0x2073
leaq 0x6e5(%rip), %rcx       # 0x212b
pushq $0x50
jmp 0x1a7a
leaq 0x700(%rip), %rdi       # 0x2151
leaq 0x61b(%rip), %rsi       # 0x2073
leaq 0x6cc(%rip), %rcx       # 0x212b
pushq $0x55
jmp 0x1a7a
leaq 0x6fd(%rip), %rdi       # 0x2167
leaq 0x602(%rip), %rsi       # 0x2073
leaq 0x6b3(%rip), %rcx       # 0x212b
pushq $0x60
popq %rdx
callq 0x1040