MCPcopy Create free account
hub / github.com/Parchive/par2cmdline / test6

Function test6

src/commandline_test.cpp:92–158  ·  view source on GitHub ↗

ComputeRecoveryBlockCount redundancy > 0

Source from the content-addressed store, hash-verified

90// ComputeRecoveryBlockCount
91// redundancy > 0
92int test6() {
93 u32 recoveryblockcount = 0;
94 bool success = CommandLine::ComputeRecoveryBlockCount(&recoveryblockcount,
95 100,
96 4,
97 0,
98 scVariable,
99 0,
100 false,
101 1,
102 0,
103 40);
104 if (!success) {
105 std::cerr << "ComputeRecoveryBlockCount failed test5.1" << std::endl;
106 return 1;
107 }
108 if (recoveryblockcount != 1) {
109 std::cerr << "ComputeRecoveryBlockCount 1% of 100 is 1" << std::endl;
110 std::cerr << " it returned " << recoveryblockcount << std::endl;
111 return 1;
112 }
113
114 recoveryblockcount = 0;
115 success = CommandLine::ComputeRecoveryBlockCount(&recoveryblockcount,
116 1000,
117 4,
118 0,
119 scVariable,
120 0,
121 false,
122 5,
123 0,
124 40);
125 if (!success) {
126 std::cerr << "ComputeRecoveryBlockCount failed test5.1" << std::endl;
127 return 1;
128 }
129 if (recoveryblockcount != 50) {
130 std::cerr << "ComputeRecoveryBlockCount 5% of 1000 is 50" << std::endl;
131 std::cerr << " it returned " << recoveryblockcount << std::endl;
132 return 1;
133 }
134
135
136 recoveryblockcount = 0;
137 success = CommandLine::ComputeRecoveryBlockCount(&recoveryblockcount,
138 10,
139 4,
140 0,
141 scVariable,
142 0,
143 false,
144 1,
145 0,
146 40);
147 if (!success) {
148 std::cerr << "ComputeRecoveryBlockCount failed test5.1" << std::endl;
149 return 1;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected