Commit 9c620674 authored by Giannis Kepas's avatar Giannis Kepas
Browse files

even more linient a1t13

parent d1e577e5
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -107,25 +107,17 @@ 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)"

    # Check that owner has at least read/write (6xx) and others have no permissions (xx0)
    # Check that owner has read/write permissions (6xx)
    file3_permissions=$(stat -c "%a" './file3')
    file4_permissions=$(stat -c "%a" './file4')
    
    # Extract owner permissions (first digit) - should be 6 or 7
    # Extract owner permissions (first digit) - should be exactly 6 (read/write, no execute)
    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" ]
    # Check owner has exactly read/write permissions (6)
    assert [ "$file3_owner" -eq "6" ]
    assert [ "$file4_owner" -eq "6" ]
}

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