Commit d1e577e5 authored by Giannis Kepas's avatar Giannis Kepas
Browse files

make a1t13 more linient

parent 206e1bea
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -107,8 +107,25 @@ setup() {
@test "[EXERCISE 13] Files 'file3' and 'file4' have read and write permissions for owner and no other permissions for others" {
    bash -c "$(awk '/# EXERCISE 13$/{flag=1; next} /# EXERCISE/{flag=0} flag' ./commands.sh)"

    assert_file_permission '600' './file3'
    assert_file_permission '600' './file4'
    # Check that owner has at least read/write (6xx) and others have no permissions (xx0)
    file3_permissions=$(stat -c "%a" './file3')
    file4_permissions=$(stat -c "%a" './file4')
    
    # Extract owner permissions (first digit) - should be 6 or 7
    file3_owner=${file3_permissions:0:1}
    file4_owner=${file4_permissions:0:1}
    
    # Extract others permissions (last digit) - should be 0
    file3_others=${file3_permissions:2:1}
    file4_others=${file4_permissions:2:1}
    
    # Check owner has at least read/write permissions (6 or 7)
    assert [ "$file3_owner" -ge "6" ]
    assert [ "$file4_owner" -ge "6" ]
    
    # Check others have no permissions (0)
    assert [ "$file3_others" -eq "0" ]
    assert [ "$file4_others" -eq "0" ]
}

@test "[EXERCISE 14] Directory 'uowm/cs' doesn't have read and write permissions" {