From 34be33a663832202d5d3dbfcbad2c5346eb4b4c2 Mon Sep 17 00:00:00 2001
From: Brendan Bartels <bbartels@iastate.edu>
Date: Sun, 23 Apr 2017 17:41:10 -0500
Subject: [PATCH] quad: remove old test files in xsdk project

---
 quad/xsdk_workspace/real_quad/test/.gitignore |   1 -
 quad/xsdk_workspace/real_quad/test/Makefile   |  10 -
 .../real_quad/test/test_uart_buff.c           | 348 ------------------
 .../xsdk_workspace/real_quad/test/xil_types.h |  10 -
 4 files changed, 369 deletions(-)
 delete mode 100644 quad/xsdk_workspace/real_quad/test/.gitignore
 delete mode 100644 quad/xsdk_workspace/real_quad/test/Makefile
 delete mode 100644 quad/xsdk_workspace/real_quad/test/test_uart_buff.c
 delete mode 100644 quad/xsdk_workspace/real_quad/test/xil_types.h

diff --git a/quad/xsdk_workspace/real_quad/test/.gitignore b/quad/xsdk_workspace/real_quad/test/.gitignore
deleted file mode 100644
index f15954588..000000000
--- a/quad/xsdk_workspace/real_quad/test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-test_uart_buff
\ No newline at end of file
diff --git a/quad/xsdk_workspace/real_quad/test/Makefile b/quad/xsdk_workspace/real_quad/test/Makefile
deleted file mode 100644
index 36613e465..000000000
--- a/quad/xsdk_workspace/real_quad/test/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# QUAD_ROOT is obtained from environment
-SRC = $(QUAD_ROOT)/sw/modular_quad_pid/src
-LIB = $(QUAD_ROOT)/lib/test
-
-test_uart_buff: test_uart_buff.c
-	gcc -o test_uart_buff -I. -I$(SRC) -I$(LIB) $(LIB)/test.o test_uart_buff.c $(SRC)/uart_buff.c
-
-.PHONY: clean
-clean:
-	rm test_uart_buff
diff --git a/quad/xsdk_workspace/real_quad/test/test_uart_buff.c b/quad/xsdk_workspace/real_quad/test/test_uart_buff.c
deleted file mode 100644
index db85a701a..000000000
--- a/quad/xsdk_workspace/real_quad/test/test_uart_buff.c
+++ /dev/null
@@ -1,348 +0,0 @@
-#include <stdio.h>
-#include "uart_buff.h"
-#include <math.h>
-#include <string.h>
-#include "test.h"
-
-int float_equals(float x1, float x2) {
-  return fabs(x1 - x2) < 10e-5;
-}
-
-void print_test_result(int success, float exp, float act) {
-  if (success) printf("passed\n");
-  else printf("FAILED: expected %f but got %f\n", exp, act);
-}
-
-int failed(char *msg) {
-  printf("%s\n", msg);
-  return 1;
-}
-
-void add_packet(u16 type, unsigned short id, unsigned short length, unsigned char *data) {
-  uart_buff_add_u8(0xBE);
-  uart_buff_add_u8(type);
-  uart_buff_add_u8(type >> 8);
-  uart_buff_add_u8(id);
-  uart_buff_add_u8(id >> 8);
-  uart_buff_add_u8(length);
-  uart_buff_add_u8(length >> 8);
-  int i;
-  for (i = 0; i < length; i += 1) {
-    uart_buff_add_u8(data[i]);
-  }
-  // fake checksum
-  uart_buff_add_u8(1);
-}
-
-void add_VRPN_packet() {
-  float arr[6] = {1.0, 1.2, 1.4, -1.5, -0.5, -1.1};
-  unsigned char *data = (unsigned char *) &arr;
-  add_packet(4, 0, 24, data);
-}
-
-void add_basic_packet() {
-  unsigned char data[6] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
-  add_packet(4, 0, 6, data);
-}
-
-void add_garbage_data() {
-  int i;
-  for (i = 0; i < 32; i += 1) {
-    uart_buff_add_u8(i);
-  }
-}
-
-
-int setup_VRPN_packet() {
-  add_VRPN_packet();
-  if (!uart_buff_packet_ready()) {
-    return 0;
-  }
-}
-
-int setup_basic_packet() {
-  add_basic_packet();
-  if (!uart_buff_packet_ready()) {
-    return 0;
-  }
-}
-
-int test_empty_when_empty() {
-  uart_buff_reset();
-  int exp = 1;
-  int act = uart_buff_empty();
-  int success = exp == act;
-  return !success;
-}
-
-int test_empty_after_receiving_some_data() {
-  uart_buff_reset();
-  add_garbage_data();
-  int exp = 0;
-  int act = uart_buff_empty();
-  int success = exp == act;
-  return !success;
-}
-
-int test_full_is_false_at_start() {
-  uart_buff_reset();
-  int exp = 0;
-  int act = uart_buff_full();
-  int success = exp == act;
-  return !success;
-}
-
-int test_full_after_receiving_some_data() {
-  uart_buff_reset();
-  add_garbage_data();
-  int exp = 0;
-  int act = uart_buff_full();
-  int success = exp == act;
-  return !success;
-}
-
-int test_buffer_size_empty() {
-  uart_buff_reset();
-  int exp = 0;
-  int act = uart_buff_size();
-  int success = exp == act;
-  return !success;
-}
-
-int test_buffer_size_after_garbage_data() {
-  uart_buff_reset();
-  add_garbage_data();
-  int exp = 32;
-  int act = uart_buff_size();
-  int success = exp == act;
-  return !success;
-}
-
-int test_buffer_size_after_garbage_data_scanned() {
-  uart_buff_reset();
-  add_garbage_data();
-  uart_buff_packet_ready();
-  int exp = 0;
-  int act = uart_buff_size();
-  int success = exp == act;
-  return !success;
-}
-
-int test_buffer_size_after_VRPN_packet() {
-  uart_buff_reset();
-  if(!setup_VRPN_packet()) return failed("FAILED: setup failed");
-  int exp = 32;
-  int act = uart_buff_size();
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u8() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xAA;
-  int act = uart_buff_data_get_u8(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u8_with_offset() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xBB;
-  int act = uart_buff_data_get_u8(1);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u16() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xBBAA;
-  int act = uart_buff_data_get_u16(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u16_with_offset() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xDDCC;
-  int act = uart_buff_data_get_u16(2);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u16_wrapped() {
-  uart_buff_reset();
-  int i;
-  for (i = 0; i < 1000; i += 1) uart_buff_add_u8(0);
-  uart_buff_packet_ready();
-  for (i = 0; i < 1040; i += 1) uart_buff_add_u8(0);
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xBBAA;
-  int act = uart_buff_data_get_u16(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u32() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  unsigned int exp = 0xDDCCBBAA;
-  unsigned int act = uart_buff_data_get_u32(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u32_with_offset() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  unsigned int exp = 0xFFEEDDCC;
-  unsigned int act = uart_buff_data_get_u32(2);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u32_wrapped_1_4() {
-  uart_buff_reset();
-  int i;
-  for (i = 0; i < 1000; i += 1) uart_buff_add_u8(0);
-  uart_buff_packet_ready();
-  for (i = 0; i < 1040; i += 1) uart_buff_add_u8(0);
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xDDCCBBAA;
-  int act = uart_buff_data_get_u32(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u32_wrapped_2_4() {
-  uart_buff_reset();
-  int i;
-  for (i = 0; i < 1000; i += 1) uart_buff_add_u8(0);
-  uart_buff_packet_ready();
-  for (i = 0; i < 1039; i += 1) uart_buff_add_u8(0);
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xDDCCBBAA;
-  int act = uart_buff_data_get_u32(0);
-  int success = exp == act;
-  return !success;
-}
-
-int test_packet_get_u32_wrapped_3_4() {
-  uart_buff_reset();
-  int i;
-  for (i = 0; i < 1000; i += 1) uart_buff_add_u8(0);
-  uart_buff_packet_ready();
-  for (i = 0; i < 1038; i += 1) uart_buff_add_u8(0);
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 0xDDCCBBAA;
-  int act = uart_buff_data_get_u32(0);
-  int success = exp == act;
-  return !success;
-}
-
-
-int test_packet_get_float() {
-  uart_buff_reset();
-  if(!setup_VRPN_packet()) return failed("FAILED: setup failed");
-  float exp = 1.0;
-  float act = uart_buff_data_get_float(0);
-  int success = float_equals(exp, act);
-  return !success;
-}
-
-int test_packet_get_float_with_offset() {
-  uart_buff_reset();
-  if(!setup_VRPN_packet()) return failed("FAILED: setup failed");
-  float exp = 1.2;
-  float act = uart_buff_data_get_float(4);
-  int success = float_equals(exp, act);
-  return !success;
-}
-
-int test_packet_ready_at_start() {
-  uart_buff_reset();
-  int exp = 0;
-  int act = uart_buff_packet_ready();
-  int success = act == exp;
-  return !success;
-}
-
-int test_packet_ready_after_receiving_packet() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  int exp = 1;
-  int act = uart_buff_packet_ready();
-  int success = act == exp;
-  return !success;
-}
-
-int test_packet_ready_after_consuming_packet() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  uart_buff_consume_packet();
-  int exp = 0;
-  int act = uart_buff_packet_ready();
-  int success = act == exp;
-  return !success;
-}
-
-int test_size_when_data_lenth_too_large() {
-  uart_buff_reset();
-  unsigned char data[UART_MAX_PACKET_SIZE + 1];
-  add_packet(4, 0, UART_MAX_PACKET_SIZE + 1, data);
-  uart_buff_packet_ready();
-  int exp = 0;
-  int act = uart_buff_size();
-  int success = act == exp;
-  return !success;
-}
-
-int test_get_raw() {
-  uart_buff_reset();
-  if(!setup_basic_packet()) return failed("FAILED: setup failed");
-  unsigned char exp[15] =
-    {0xBE, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x01};
-  size_t length;
-  unsigned char *act = (unsigned char *) uart_buff_get_raw(&length);
-  int success = 1;
-  int i;
-  for (i = 0; i < length; i += 1) {
-    success = success && (exp[i] == act[i]);
-    if (!success) {
-      break;
-    }
-  }
-  return !success;
-}
-
-int main() {
-  test(test_empty_when_empty, "test empty when empty");
-  test(test_empty_after_receiving_some_data, "test empty after recieving soem data");
-  test(test_full_is_false_at_start, "test full is false at start");
-  test(test_full_after_receiving_some_data, "test full after receiving some data");
-  test(test_packet_get_u8, "test packet get u8");
-  test(test_packet_get_u8_with_offset, "test packet get u8 with offset");
-  test(test_packet_get_u16, "test packet get u16");
-  test(test_packet_get_u16_with_offset, "test packet get u16 wrapped");
-  test(test_packet_get_u16_wrapped, "test packet get u16 wrapped");
-  test(test_packet_get_u32, "test packet get u32");
-  test(test_packet_get_u32_with_offset, "test packet get u32 with offset");
-  test(test_packet_get_u32_wrapped_1_4, "test packet get u32 wrapped 1/4");
-  test(test_packet_get_u32_wrapped_2_4, "test packet get u32 warpped 2/4");
-  test(test_packet_get_u32_wrapped_3_4, "test packet get u32 wrapped 3/4");
-  test(test_packet_get_float, "test packet get u32 wrapped 3/4");
-  test(test_packet_get_float_with_offset, "test packet get float with offset");
-  test(test_buffer_size_after_VRPN_packet, "test buffer size after VRPN packet");
-  test(test_buffer_size_empty, "test buffer size empty");
-  test(test_buffer_size_after_garbage_data, "test buffer size after garbage data");
-  test(test_buffer_size_after_garbage_data_scanned, "test buffer size after garbage data scanned");
-  test(test_packet_ready_at_start, "test packet ready at start");
-  test(test_packet_ready_after_receiving_packet, "test packet ready after receiving packet");
-  test(test_packet_ready_after_consuming_packet, "test packet ready after consuming packet");
-  test(test_size_when_data_lenth_too_large, "test size when data length too large");
-
-  return test_summary();
-}
diff --git a/quad/xsdk_workspace/real_quad/test/xil_types.h b/quad/xsdk_workspace/real_quad/test/xil_types.h
deleted file mode 100644
index d67aef849..000000000
--- a/quad/xsdk_workspace/real_quad/test/xil_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef XIL_TYPES_H
-#define XIL_TYPES_H
-
-#include <stddef.h>
-
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-
-#endif
-- 
GitLab