MCPcopy Index your code
hub / github.com/ccxt/ccxt / runTests

Method runTests

java/tests/src/main/java/tests/exchange/TestMain.java:598–638  ·  view source on GitHub ↗
(Exchange exchange, Object tests, Object isPublicTest)

Source from the content-addressed store, hash-verified

596 }
597
598 public java.util.concurrent.CompletableFuture<Object> runTests(Exchange exchange, Object tests, Object isPublicTest)
599 {
600
601 return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
602
603 Object testNames = Helpers.objectKeys(tests);
604 Object promises = new java.util.ArrayList<Object>(java.util.Arrays.asList());
605 for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(testNames)); i++)
606 {
607 Object testName = Helpers.GetValue(testNames, i);
608 Object testArgs = Helpers.GetValue(tests, testName);
609 ((java.util.List<Object>)promises).add(this.testSafe(testName, exchange, testArgs, isPublicTest));
610 }
611 // todo - not yet ready in other langs too
612 // promises.push (testThrottle ());
613 Object results = (Helpers.promiseAll(promises)).join();
614 // now count which test-methods retuned `false` from "testSafe" and dump that info below
615 Object failedMethods = new java.util.ArrayList<Object>(java.util.Arrays.asList());
616 for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(testNames)); i++)
617 {
618 Object testName = Helpers.GetValue(testNames, i);
619 Object testReturnedValue = Helpers.GetValue(results, i);
620 if (!Helpers.isTrue(testReturnedValue))
621 {
622 ((java.util.List<Object>)failedMethods).add(testName);
623 }
624 }
625 Object testPrefixString = ((Helpers.isTrue(isPublicTest))) ? "PUBLIC_TESTS" : "PRIVATE_TESTS";
626 if (Helpers.isTrue(Helpers.getArrayLength(failedMethods)))
627 {
628 Object errorsString = String.join((String)", ", (java.util.List<String>)failedMethods);
629 dump("[TEST_FAILURE]", exchange.id, testPrefixString, Helpers.add("Failed methods : ", errorsString));
630 }
631 if (Helpers.isTrue(this.info))
632 {
633 dump(this.addPadding(Helpers.add(Helpers.add(Helpers.add("[INFO] END ", testPrefixString), " "), exchange.id), 25));
634 }
635 return true;
636 });
637
638 }
639
640 public java.util.concurrent.CompletableFuture<Object> loadExchange(Exchange exchange)
641 {

Callers 2

runPublicTestsMethod · 0.95
runPrivateTestsMethod · 0.95

Calls 11

objectKeysMethod · 0.95
isLessThanMethod · 0.95
getArrayLengthMethod · 0.95
GetValueMethod · 0.95
testSafeMethod · 0.95
promiseAllMethod · 0.95
isTrueMethod · 0.95
addMethod · 0.95
addPaddingMethod · 0.95
addMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected