ComputeRecoveryBlockCount redundnacysize > 0 scUniform with number of recovery files already determined.
| 214 | // redundnacysize > 0 |
| 215 | // scUniform with number of recovery files already determined. |
| 216 | int test7() { |
| 217 | // CD is 10 files, 600 source blocks, 1MB block size |
| 218 | // Redundancys is 40MB in 5 files. |
| 219 | |
| 220 | //sourcefilecount, sourceblockcount, blocksize, redundancysize, recoveryfilecount |
| 221 | if (test7_helper(10, 600, 1024*1024, 40*1024*1024, 5)) |
| 222 | return 1; |
| 223 | |
| 224 | if (test7_helper( 1, 600, 1024*1024, 40*1024*1024, 5)) |
| 225 | return 1; |
| 226 | |
| 227 | if (test7_helper(10, 60, 1024*1024, 40*1024*1024, 5)) |
| 228 | return 1; |
| 229 | |
| 230 | if (test7_helper(10, 600, 16*1024, 40*1024*1024, 5)) |
| 231 | return 1; |
| 232 | |
| 233 | if (test7_helper(10, 600, 1024*1024, 10*1024*1024, 5)) |
| 234 | return 1; |
| 235 | |
| 236 | if (test7_helper(10, 600, 1024*1024, 40*1024*1024, 2)) |
| 237 | return 1; |
| 238 | |
| 239 | |
| 240 | // DVD is 1 files, 5000 source blocks, 1MB block size |
| 241 | // Redundancys is 50MB in 5 files. |
| 242 | if (test7_helper(1, 5000, 1024*1024, 50*1024*1024, 5) == 1) |
| 243 | return 1; |
| 244 | |
| 245 | |
| 246 | // if redundancy size is too small, still have 1 block |
| 247 | u32 recoveryblockcount; |
| 248 | bool success = CommandLine::ComputeRecoveryBlockCount(&recoveryblockcount, |
| 249 | 1000, |
| 250 | 1024, |
| 251 | 0, |
| 252 | scUniform, |
| 253 | 1, |
| 254 | false, |
| 255 | 0, |
| 256 | 4, // = redundancysize |
| 257 | 1024); |
| 258 | if (!success) { |
| 259 | std::cerr << "ComputeRecoveryBlockCount failed test5.1" << std::endl; |
| 260 | return 1; |
| 261 | } |
| 262 | if (recoveryblockcount != 1) { |
| 263 | std::cerr << "ComputeRecoveryBlockCount with small redundancy amount should still return 1" << std::endl; |
| 264 | std::cerr << " it returned " << recoveryblockcount << std::endl; |
| 265 | return 1; |
| 266 | } |
| 267 | |
| 268 | return 0; |
| 269 | } |
| 270 | |
| 271 | |
| 272 |