MCPcopy Create free account
hub / github.com/christophhart/HISE / createAsciiDiff

Method createAsciiDiff

hi_scripting/scripting/scriptnode/api/TestClasses.cpp:247–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247String ScriptNetworkTest::createAsciiDiff(var data1, var data2, int numLines)
248{
249 Buffer2Ascii b1(data1, numLines);
250 Buffer2Ascii b2(data2, numLines);
251
252 b1.setCharacterSet("O/\\ - ==|");
253 b2.setCharacterSet("O/\\ - ==|");
254
255 auto r = b1.sanityCheck();
256
257 if (!r.wasOk())
258 {
259 reportScriptError(r.getErrorMessage());
260 RETURN_IF_NO_THROW({});
261 }
262
263 r = b2.sanityCheck();
264
265 if (!r.wasOk())
266 {
267 reportScriptError(r.getErrorMessage());
268 RETURN_IF_NO_THROW({});
269 }
270
271 auto s1 = b1.toString();
272 auto s2 = b2.toString();
273
274 if (s1.compare(s2) == 0)
275 {
276 return s1;
277 }
278 else
279 {
280 auto p1 = s1.begin();
281 auto p2 = s2.begin();
282
283 int l = s1.length();
284 int l2 = s2.length();
285
286 ignoreUnused(l2);
287 jassert(l == l2);
288
289 String newC;
290 newC.preallocateBytes(l);
291
292 for (int i = 0; i < l; i++)
293 {
294 if (*p1 != *p2)
295 newC << 'X';
296 else
297 newC << *p1;
298
299 ++p1;
300 ++p2;
301 }
302
303 return newC;
304 }

Callers

nothing calls this directly

Calls 10

ignoreUnusedFunction · 0.85
setCharacterSetMethod · 0.80
preallocateBytesMethod · 0.80
sanityCheckMethod · 0.45
wasOkMethod · 0.45
getErrorMessageMethod · 0.45
toStringMethod · 0.45
compareMethod · 0.45
beginMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected