/******************************** /
\ testlru3.c                      \
/                                 /
\ Single-threaded LRU correctness \
/ test, testing the LRU_Remove    /
\ function.                       \
/*********************************/

#include "lru.h"
#include <stdlib.h>
#include <stdio.h>

int main() {
  LRU_Init(1000);
  srand(59);
  int i;
  
  // Fill up the LRU
  for(i = 1; i <= 1000; i++) {
    LRU_Insert(i);
  }
  
  // Remove every element from the LRU
  for(i = 1000; i > 0; i--) {
    if (LRU_Remove(i)) {
      printf("Test failed.\n");
      return 0;
    }
  }
  
  // Make sure LRU_Remove returns -1 when a number not in the LRU is given.
  if (LRU_Remove(9999) != -1) {
    printf("Test failed.\n");
    return 0;
  }

  printf("Test Passed.\n");
  return 0;
}
