From 175721a63b426355274fa9e8063f762020ab8362 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 30 Jan 2020 16:55:04 -0600 Subject: R E A R R A N G E --- ee1301/filename_test.m | 88 -------------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 ee1301/filename_test.m (limited to 'ee1301/filename_test.m') diff --git a/ee1301/filename_test.m b/ee1301/filename_test.m deleted file mode 100644 index d8f2a59..0000000 --- a/ee1301/filename_test.m +++ /dev/null @@ -1,88 +0,0 @@ -function valid = filename_test(fileLoc, tar_name, username, hwNumber, numOfAssignment) -% fileLoc is the folder where you stored your tar file, you can find it by cd into the folder and -% type "pwd" in terminal, don't forget to put it in quote like this: -% 'fileLoc', because it's a string! - -% tar_name is the name of the tar file you want to test, it should also be -% a string, so again, don't forget the quote! - -% username is your X500 ID, also a string! - -% hwNumber is the number of assignment, "HW hwNumber". input just a number here - -% numOfAssignment is how many problems are there in this assignment, also a number - -% Example command: -% filename_test('/home/jc/Desktop', 'hw1_yuanx320.tgz', 'yuanx320', 1, 2); - -% -----------------How to use:------------------- -% ----------------------------------------------- -% - Upload this file to CSE machine -% - Log into CSE machine and open terminal -% - In terminal, cd into the folder where you store this matlab code -% - Type "matlab", wait for matlab open -% - In the command window of matlab, type in the command you generated -% following the instructions up there - - -% ----------------Expected output------------------ -% ------------------------------------------------- -% After running the tester, -% in the command window of matlab you will see some output -% Modify your file name accoddingly until you see "File name test passed!" -% - -% tar_name = strcat(sprintf('hw%d_',hwNumber), username, '.tgz'); -cd(fileLoc); -untar(tar_name); - -folder_name = sprintf('hw%d_directory', hwNumber); -file_name = cell(numOfAssignment); -a = 'A'; -for i = 1:numOfAssignment - b = char(a+i-1); - file_name{i} = strcat(username, sprintf('_HW%d', hwNumber), b, '.cpp'); -end - - -mkdir temp; -command1 = strcat('tar -xzvf ', tar_name, ' -C temp/'); -system(command1); -cd temp; -a = exist(folder_name); -valid = true; - -if a == 7 - cd(folder_name); - filecpp = dir('*.cpp'); - if ~isempty(filecpp) - for i = 1:numOfAssignment - if strcmp(filecpp(i).name, file_name{i, 1}) == false - valid = false; - end - end - - if valid == 0 - fprintf(".cpp file name incorrect! Example: yuanx320_HW2A.cpp\n"); - else - fprintf("File name test passed!\n"); - end - - else - fprintf("No .cpp file included in this directory.\n"); - end - cd ..; - - - - -else - fprintf("Wrong folder name, it should be hw2_directory.\n"); -end - -cd ..; -rmdir temp s; - - - -end \ No newline at end of file -- cgit v1.2.3