check50

cs50/problems/2021/x/filter/less


:) helpers.c exists

Log
checking that helpers.c exists...

:) filter compiles

Log
running clang testing.c helpers.c -o testing -std=c11 -ggdb -lm...

:) grayscale correctly filters single pixel with whole number average

Log
testing with pixel (20, 40, 90)
running ./testing 0 0...
checking for output "50 50 50\n"...

:) grayscale correctly filters single pixel without whole number average

Log
testing with pixel (27, 28, 28)
running ./testing 0 1...
checking for output "28 28 28\n"...

:) grayscale leaves alone pixels that are already gray

Log
testing with pixel (50, 50, 50)
running ./testing 0 2...
checking for output "50 50 50\n"...

:) grayscale correctly filters simple 3x3 image

Log
testing with sample 3x3 image
first row: (255, 0, 0), (255, 0, 0), (255, 0, 0)
second row: (0, 255, 0), (0, 255, 0), (0, 255, 0)
third row: (0, 0, 255), (0, 0, 255), (0, 0, 255)
running ./testing 0 3...
checking for output "85 85 85\n85 85 85\n85 85 85\n85 85 85\n85 85 85\n85 85 85\n85 85 85\n85 85 85\n85 85 85\n"...

:) grayscale correctly filters more complex 3x3 image

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 0 4...
checking for output "20 20 20\n50 50 50\n80 80 80\n127 127 127\n137 137 137\n147 147 147\n210 210 210\n230 230 230\n248 248 248\n"...

:) grayscale correctly filters 4x4 image

Log
testing with sample 4x4 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90), (100, 110, 120)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160), (140, 160, 170)
third row: (195, 204, 213), (205, 214, 223), (225, 234, 243), (245, 254, 253)
fourth row: (50, 28, 90), (0, 0, 0), (255, 255, 255), (85, 85, 85)
running ./testing 0 5...
checking for output "20 20 20\n50 50 50\n80 80 80\n110 110 110\n127 127 127\n137 137 137\n147 147 147\n157 157 157\n204 204 204\n214 214 214\n234 234 234\n251 251 251\n56 56 56\n0 0 0\n255 255 255\n85 85 85\n"...

:) sepia correctly filters single pixel

Log
testing with pixel (20, 40, 90)
running ./testing 1 0...
checking for output "56 50 39\n"...

:) sepia correctly filters simple 3x3 image

Log
testing with sample 3x3 image
first row: (255, 0, 0), (255, 0, 0), (255, 0, 0)
second row: (0, 255, 0), (0, 255, 0), (0, 255, 0)
third row: (0, 0, 255), (0, 0, 255), (0, 0, 255)
running ./testing 1 3...
checking for output "100 89 69\n100 89 69\n100 89 69\n196 175 136\n196 175 136\n196 175 136\n48 43 33\n48 43 33\n48 43 33\n"...

:) sepia correctly filters more complex 3x3 image

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 1 4...
checking for output "25 22 17\n66 58 45\n106 94 74\n170 151 118\n183 163 127\n197 175 136\n255 251 195\n255 255 214\n255 255 232\n"...

:) sepia correctly filters 4x4 image

Log
testing with sample 4x4 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90), (100, 110, 120)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160), (140, 160, 170)
third row: (195, 204, 213), (205, 214, 223), (225, 234, 243), (245, 254, 253)
fourth row: (50, 28, 90), (0, 0, 0), (255, 255, 255), (85, 85, 85)
running ./testing 1 5...
checking for output "25 22 17\n66 58 45\n106 94 74\n147 131 102\n170 151 118\n183 163 127\n197 175 136\n210 187 146\n255 244 190\n255 255 199\n255 255 218\n255 255 235\n58 52 40\n0 0 0\n255 255 239\n115 102 80\n"...

:) reflect correctly filters 1x2 image

Log
testing with sample 1x2 image
first row: (255, 0, 0), (0, 0, 255)
running ./testing 2 0...
checking for output "0 0 255\n255 0 0\n"...

:) reflect correctly filters 1x3 image

Log
testing with sample 1x3 image
first row: (255, 0, 0), (0, 255, 0), (0, 0, 255)
running ./testing 2 1...
checking for output "0 0 255\n0 255 0\n255 0 0\n"...

:) reflect correctly filters image that is its own mirror image

Log
testing with sample 3x3 image
first row: (255, 0, 0), (255, 0, 0), (255, 0, 0)
second row: (0, 255, 0), (0, 255, 0), (0, 255, 0)
third row: (0, 0, 255), (0, 0, 255), (0, 0, 255)
running ./testing 2 2...
checking for output "255 0 0\n255 0 0\n255 0 0\n0 255 0\n0 255 0\n0 255 0\n0 0 255\n0 0 255\n0 0 255\n"...

:) reflect correctly filters 3x3 image

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 2 3...
checking for output "70 80 90\n40 50 60\n10 20 30\n130 150 160\n120 140 150\n110 130 140\n240 250 255\n220 230 240\n200 210 220\n"...

:) reflect correctly filters 4x4 image

Log
testing with sample 4x4 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90), (100, 110, 120)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160), (140, 160, 170)
third row: (195, 204, 213), (205, 214, 223), (225, 234, 243), (245, 254, 253)
fourth row: (50, 28, 90), (0, 0, 0), (255, 255, 255), (85, 85, 85)
running ./testing 2 4...
checking for output "100 110 120\n70 80 90\n40 50 60\n10 20 30\n140 160 170\n130 150 160\n120 140 150\n110 130 140\n245 254 253\n225 234 243\n205 214 223\n195 204 213\n85 85 85\n255 255 255\n0 0 0\n50 28 90\n"...

:) blur correctly filters middle pixel

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 3 0...
checking for output "127 140 149\n"...

:) blur correctly filters pixel on edge

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 3 1...
checking for output "80 95 105\n"...

:) blur correctly filters pixel in corner

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 3 2...
checking for output "70 85 95\n"...

:( blur correctly filters 3x3 image

Cause
expected "70 85 95\n80 9...", not "70 85 95\n80 9..."

Log
testing with sample 3x3 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160)
third row: (200, 210, 220), (220, 230, 240), (240, 250, 255)
running ./testing 3 3...
checking for output "70 85 95\n80 95 105\n90 105 115\n117 130 140\n127 140 149\n137 150 159\n163 178 188\n170 185 194\n178 193 201\n"...

Expected Output:
70 85 95
80 95 105
90 105 115
117 130 140
127 140 149
137 150 159
163 178 188
170 185 194
178 193 201
Actual Output:
70 85 95
80 95 105
112 127 137
117 130 140
127 140 149
140 166 147
164 161 126
151 167 144
139 167 157

:( blur correctly filters 4x4 image

Cause
expected "70 85 95\n80 9...", not "70 85 95\n80 9..."

Log
testing with sample 4x4 image
first row: (10, 20, 30), (40, 50, 60), (70, 80, 90), (100, 110, 120)
second row: (110, 130, 140), (120, 140, 150), (130, 150, 160), (140, 160, 170)
third row: (195, 204, 213), (205, 214, 223), (225, 234, 243), (245, 254, 253)
fourth row: (50, 28, 90), (0, 0, 0), (255, 255, 255), (85, 85, 85)
running ./testing 3 4...
checking for output "70 85 95\n80 95 105\n100 115 125\n110 125 135\n113 126 136\n123 136 145\n142 155 163\n152 165 173\n113 119 136\n143 151 164\n156 166 171\n180 190 194\n113 112 132\n155 156 171\n169 174 177\n203 207 209\n"...

Expected Output:
70 85 95
80 95 105
100 115 125
110 125 135
113 126 136
123 136 145
142 155 163
152 165 173
113 119 136
143 151 164
156 166 171
180 190 194
113 112 132
155 156 171
169 174 177
203 207 209
Actual Output:
70 85 95
80 95 105
100 115 125
124 139 149
113 126 136
123 136 145
142 155 163
141 150 164
113 119 136
143 151 164
156 166 171
149 157 185
99 123 124
119 137 138
127 144 121
98 99 124