/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "../includes/common.h"
#include "fifo/FifoBuffer.h"
#include "fifo/FifoController.h"
#include <stdlib.h>

#define CAPACITY 83
#define THRESHOLD 47
#define NUM_FRAMES -9999999999

using android::FifoController;

int main() {
  FifoController fifoController(CAPACITY, THRESHOLD);
  fifoController.advanceReadIndex((android::fifo_frames_t)NUM_FRAMES);
  fifoController.advanceWriteIndex((android::fifo_frames_t)NUM_FRAMES);
  int32_t readIndex = fifoController.getReadIndex();
  int32_t writeIndex = fifoController.getWriteIndex();

  if ((readIndex < 0) || (writeIndex < 0)) {
    return EXIT_VULNERABLE;
  }
  return EXIT_SUCCESS;
}
