Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # EXPLANATION
- # ==========================================================================
- # Populates the current directory with the appropriate: Makefile and tests
- # for projects and exercises in 357 Winter Quarter 2018.
- # Additionally this content will be printed conveniently to the terminal.
- # I use the following directory naming scheme
- # ~357/exercises/Exercise1/source/Makefile
- # ~357/projects/Project1/evaluations/descCore
- # ~357/projects/Project1/evaluations/descFeature
- # USAGE
- # ==========================================================================
- # if current directory is 'Exercise1'
- # then it will get Makefile and tests for Exercise1
- getDetails
- # ==========================================================================
- #!/bin/bash
- # colors!
- RED='\033[0;31m'
- BLUE='\033[0;34m'
- CYAN='\033[0;36m'
- WHITE='\033[0;37m'
- RESET='\033[0m'
- # get the current directory name
- name=${PWD##*/}
- kurt=~kmammen-grader/evaluations/W18/357/$name
- # get Makefile, requirements and tests
- mkdir source
- mkdir evaluations
- tail -n +1 $kurt/Makefile > source/Makefile
- tail -n +1 $kurt/requirements > evaluations/requirements
- tail -n +1 $kurt/tests/core/**/description > evaluations/descCore
- tail -n +1 $kurt/tests/feature/**/description > evaluations/descFeature
- # print requirements
- printf "${WHITE}Requirements\n${RESET}"
- echo ............
- cat $kurt/requirements
- echo
- # print core tests with values
- if [ -e $kurt/tests/core/testList ]; then
- NUM_CORE=$(cat $kurt/tests/core/testList | wc -l)
- NUM_CORE_VAL=$(cat $kurt/tests/core/value)
- ls $kurt/tests/core/
- printf "${WHITE}Number of core tests: $NUM_CORE${RESET} | ${CYAN}value of core tests: $NUM_CORE_VAL\n${RESET}"
- echo ..................................................
- let NUM_CORE+=1
- COUNTER=1
- while [ $COUNTER -lt $NUM_CORE ]; do
- printf "${BLUE}core test0$COUNTER${RESET}\n"
- cat $kurt/tests/core/test0$COUNTER/description
- echo
- let COUNTER+=1
- done
- fi
- # print feature tests with values
- if [ -e $kurt/tests/feature/testList ]; then
- NUM_FEAT=$(cat $kurt/tests/feature/testList | wc -l)
- ls $kurt/tests/feature/
- printf "${WHITE}Number of feature tests: $NUM_FEAT${RESET}\n"
- echo ..........................
- let NUM_FEAT+=1
- COUNTER=1
- while [ $COUNTER -lt $NUM_FEAT ]; do
- if (( $COUNTER < 10 ))
- then
- NUM_FEAT_VAL=$(cat $kurt/tests/feature/test0$COUNTER/value)
- printf "${BLUE}feature test0$COUNTER${RESET} | ${CYAN}value of feature test0$COUNTER: $NUM_FEAT_VAL\n${RESET}"
- cat $kurt/tests/feature/test0$COUNTER/description
- else
- NUM_FEAT_VAL=$(cat $kurt/tests/feature/test$COUNTER/value)
- printf "${BLUE}feature test$COUNTER${RESET} | ${CYAN}value of feature test$COUNTER: $NUM_FEAT_VAL\n${RESET}"
- cat $kurt/tests/feature/test$COUNTER/description
- fi
- echo
- let COUNTER+=1
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement