Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/username.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
your-github-username-here-in-conf-file
haimts
2 changes: 1 addition & 1 deletion examples/autotest-validate/autotest-validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ bool this_function_returns_false()
*/
const char *my_username()
{
return "todo-please-enter-your-username-here-in-my_username";
return "haimts";
}
18 changes: 18 additions & 0 deletions finder-app/finder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
filesdir=$1
searchstr=$2
if [ $# -ne 2 ]
then
echo must specify serch dir and tooken
exit 1
fi
if [ -d $1 ]
then
fileslist=$( ls -1 $filesdir )
filesCount=$( ls -1 $filesdir | wc -l )
searchInFilesCount=$( grep -r "$searchstr" $filesdir 2>/dev/null |wc -l )
echo The number of files are $filesCount and the number of matching lines are $searchInFilesCount
else
echo $1 not seems to be a directory
exit 1
fi
27 changes: 27 additions & 0 deletions finder-app/writer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
newfilename=$1
strtoinsert=$2
if [ $# -ne 2 ]
then
echo "need to specify both argument"
exit 1
fi
mkdir -p $( dirname $newfilename)
if [ $? -ne 0 ]
then
echo "can\'t create file path"
exit 1
fi
touch $newfilename
if [ -w $newfilename ]
then
if [ $? -ne 0 ] || [ -d $newfilename ]
then
echo "can\'t create file $newfilename"
exit 1
fi
echo $strtoinsert > $newfilename
else
echo "$newfilename is not writable"
exit 1
fi
8 changes: 5 additions & 3 deletions student-test/assignment1/Test_validate_username.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

/**
* This function should:
* 1) Call the my_username() function in autotest-validate.c to get your hard coded username.
* 1) Call the my_username() function in Test_assignment_validate.c to get your hard coded username.
* 2) Obtain the value returned from function malloc_username_from_conf_file() in username-from-conf-file.h within
* the assignment autotest submodule at assignment-autotest/test/assignment1/
* 3) Use unity assertion TEST_ASSERT_EQUAL_STRING_MESSAGE to verify the two strings are equal. See
* 3) Use unity assertion TEST_ASSERT_EQUAL_STRING_MESSAGE the two strings are equal. See
* the [unity assertion reference](https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityAssertionsReference.md)
*/
void test_validate_my_username()
Expand All @@ -18,5 +18,7 @@ void test_validate_my_username()
* TODO: Replace the line below with your code here as described above to verify your /conf/username.txt
* config file and my_username() functions are setup properly
*/
TEST_ASSERT_TRUE_MESSAGE(false,"AESD students, please fix me!");
const char * name = my_username();
char * confName = malloc_username_from_conf_file();
TEST_ASSERT_EQUAL_STRING_MESSAGE(name, confName,"Git User Name does't match!");
}