| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | ************************************************************************************/ |
| 22 | #include "test.h"cxx . . $ `<file>/src/unittest/test.h`/ |
| 23 | #include <dpp/dpp.h>cxx . . $ `<file>/include/dpp/dpp.h`/ |
| 24 | #include <dpp/json.h>cxx . . $ `<file>/include/dpp/json.h`/ |
| 25 | |
| 26 | double startcxx . . $ start. = dpp::utilitycxx . . $ dpp/utility/::time_fcxx . . $ dpp/utility/time_f(31fa7155c10fdd13).(); |
| 27 | bool offlinecxx . . $ offline. = false; |
| 28 | bool extendedcxx . . $ extended. = false; |
| 29 | |
| 30 | dpp::snowflakecxx . . $ dpp/snowflake# TEST_GUILD_IDcxx . . $ TEST_GUILD_ID. = stdcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).::stoullcxx . . $ std/__cxx11/stoull(a77875cccde39aac).(SAFE_GETENVcxx . . $ `src/unittest/test.h:286:9`!("TEST_GUILD_ID")); |
| 31 | dpp::snowflakecxx . . $ dpp/snowflake# TEST_TEXT_CHANNEL_IDcxx . . $ TEST_TEXT_CHANNEL_ID. = stdcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).::stoullcxx . . $ std/__cxx11/stoull(a77875cccde39aac).(SAFE_GETENVcxx . . $ `src/unittest/test.h:286:9`!("TEST_TEXT_CHANNEL_ID")); |
| 32 | dpp::snowflakecxx . . $ dpp/snowflake# TEST_VC_IDcxx . . $ TEST_VC_ID. = stdcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).::stoullcxx . . $ std/__cxx11/stoull(a77875cccde39aac).(SAFE_GETENVcxx . . $ `src/unittest/test.h:286:9`!("TEST_VC_ID")); |
| 33 | dpp::snowflakecxx . . $ dpp/snowflake# TEST_USER_IDcxx . . $ TEST_USER_ID. = stdcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).::stoullcxx . . $ std/__cxx11/stoull(a77875cccde39aac).(SAFE_GETENVcxx . . $ `src/unittest/test.h:286:9`!("TEST_USER_ID")); |
| 34 | dpp::snowflakecxx . . $ dpp/snowflake# TEST_EVENT_IDcxx . . $ TEST_EVENT_ID. = stdcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).::stoullcxx . . $ std/__cxx11/stoull(a77875cccde39aac).(SAFE_GETENVcxx . . $ `src/unittest/test.h:286:9`!("TEST_EVENT_ID")); |
| 35 | |
| 36 | test_tcxx . . $ test_t#::test_tcxx . . $ test_t#test_t(3a7d5cc967913103).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# testname, stdcxx . . $ std/::string_viewcxx . . $ std/string_view# testdesc, int testflags) : namecxx . . $ test_t#name.{testname}, descriptioncxx . . $ test_t#description.{testdesc}, flagscxx . . $ test_t#flags.{static_cast<test_flags_tcxx . . $ test_flags_t#>(testflags)} { |
| 37 | testscxx . . $ tests..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(this); |
| 38 | } |
| 39 | |
| 40 | void set_statuscxx . . $ set_status(69213411294ab03e).(test_tcxx . . $ test_t# &test, test_status_tcxx . . $ test_status_t# newstatus, stdcxx . . $ std/::string_viewcxx . . $ std/string_view# message) { |
| 41 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockercxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(loglockcxx . . $ loglock.); |
| 42 | |
| 43 | if (is_skippedcxx . . $ is_skipped(b88c5c295d724553).(test) || newstatus == test.statuscxx . . $ test_t#status.) { |
| 44 | return; |
| 45 | } |
| 46 | if (test.statuscxx . . $ test_t#status. != ts_failedcxx . . $ ts_failed.) { // disallow changing the state of a failed test, but we still log |
| 47 | test.statuscxx . . $ test_t#status. = newstatus; |
| 48 | } |
| 49 | switch (newstatus) { |
| 50 | case ts_startedcxx . . $ ts_started.: |
| 51 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[33mTESTING\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). testcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02)..descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). (message.emptycxx . . $ std/basic_string_view#empty(3482b152b9333168).() ? ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). : " - " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/__cxx11/basic_string#basic_string(bf1c47f775a49a2c).::stringcxx . . $ std/string#{message} ) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 52 | break; |
| 53 | |
| 54 | case ts_failedcxx . . $ ts_failed.: |
| 55 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[31mFAILED\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). testcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02)..descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). (message.emptycxx . . $ std/basic_string_view#empty(3482b152b9333168).() ? ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). : " - " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/__cxx11/basic_string#basic_string(bf1c47f775a49a2c).::stringcxx . . $ std/string#{message} ) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 56 | break; |
| 57 | |
| 58 | case ts_successcxx . . $ ts_success.: |
| 59 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[32mSUCCESS\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). testcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02)..descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). (message.emptycxx . . $ std/basic_string_view#empty(3482b152b9333168).() ? ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). : " - " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/__cxx11/basic_string#basic_string(bf1c47f775a49a2c).::stringcxx . . $ std/string#{message} ) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 60 | break; |
| 61 | |
| 62 | case ts_skippedcxx . . $ ts_skipped.: |
| 63 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[33mSKIPPED\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). testcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02)..descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). (message.emptycxx . . $ std/basic_string_view#empty(3482b152b9333168).() ? ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). : " - " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/__cxx11/basic_string#basic_string(bf1c47f775a49a2c).::stringcxx . . $ std/string#{message} ) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 64 | break; |
| 65 | |
| 66 | default: |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void start_testcxx . . $ start_test(271d3161c6a64dec).(test_tcxx . . $ test_t# &test) { |
| 72 | set_statuscxx . . $ set_status(69213411294ab03e).(test, ts_startedcxx . . $ ts_started.); |
| 73 | } |
| 74 | |
| 75 | void skip_testcxx . . $ skip_test(271d3161c6a64dec).(test_tcxx . . $ test_t# &test) { |
| 76 | set_statuscxx . . $ set_status(69213411294ab03e).(test, ts_skippedcxx . . $ ts_skipped.); |
| 77 | } |
| 78 | |
| 79 | void set_testcxx . . $ set_test(c715a584a48bbbaa).(test_tcxx . . $ test_t# &test, bool success) { |
| 80 | if (test.statuscxx . . $ test_t#status. == ts_not_executedcxx . . $ ts_not_executed.) { |
| 81 | set_statuscxx . . $ set_status(69213411294ab03e).(test, success ? ts_successcxx . . $ ts_success. : ts_startedcxx . . $ ts_started.); |
| 82 | } else { |
| 83 | set_statuscxx . . $ set_status(69213411294ab03e).(test, success ? ts_successcxx . . $ ts_success. : ts_failedcxx . . $ ts_failed.); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | bool is_skippedcxx . . $ is_skipped(b88c5c295d724553).(const test_tcxx . . $ test_t# &test) { |
| 88 | return (test.flagscxx . . $ test_t#flags. & tf_onlinecxx . . $ tf_online. && offlinecxx . . $ offline.) || (test.flagscxx . . $ test_t#flags. & tf_extendedcxx . . $ tf_extended. && !extendedcxx . . $ extended.) || (test.flagscxx . . $ test_t#flags. & tf_corocxx . . $ tf_coro. && !corocxx . . $ coro.); |
| 89 | } |
| 90 | |
| 91 | double get_start_timecxx . . $ get_start_time(31fa7155c10fdd13).() { |
| 92 | return startcxx . . $ start.; |
| 93 | } |
| 94 | |
| 95 | double get_timecxx . . $ get_time(31fa7155c10fdd13).() { |
| 96 | return dpp::utilitycxx . . $ dpp/utility/::time_fcxx . . $ dpp/utility/time_f(31fa7155c10fdd13).() - get_start_timecxx . . $ get_start_time(31fa7155c10fdd13).(); |
| 97 | } |
| 98 | |
| 99 | int test_summarycxx . . $ test_summary(b126dc7c1de90089).() { |
| 100 | /* Report on all test cases */ |
| 101 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockercxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(loglockcxx . . $ loglock.); |
| 102 | int failed = 0, passed = 0, skipped = 0; |
| 103 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\u001b[37;1m\n\nUNIT TEST SUMMARY\n==================\n\u001b[0m"; |
| 104 | for (auto & t : testscxx . . $ tests.) { |
| 105 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::leftcxx . . $ std/left(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(60) <<cxx . . $ std/`operator<<`(cb6f908c4937f172). tcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).->descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(6); |
| 106 | if (t->statuscxx . . $ test_t#status. == ts_skippedcxx . . $ ts_skipped. || (t->flagscxx . . $ test_t#flags. & tf_onlinecxx . . $ tf_online. && offlinecxx . . $ offline.) || (t->flagscxx . . $ test_t#flags. & tf_extendedcxx . . $ tf_extended. && !extendedcxx . . $ extended.) || (t->flagscxx . . $ test_t#flags. & tf_corocxx . . $ tf_coro. && !corocxx . . $ coro.)) { |
| 107 | skipped++; |
| 108 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\u001b[33mSKIPPED"; |
| 109 | } else { |
| 110 | if (t->statuscxx . . $ test_t#status. == ts_successcxx . . $ ts_success.) { |
| 111 | passed++; |
| 112 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\u001b[32mPASS"; |
| 113 | } else { |
| 114 | failed++; |
| 115 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (t->statuscxx . . $ test_t#status. == ts_not_executedcxx . . $ ts_not_executed. ? "\u001b[31mNOT EXECUTED" : "\u001b[31mFAIL"); |
| 116 | } |
| 117 | } |
| 118 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(0) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\u001b[0m\n"; |
| 119 | } |
| 120 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\u001b[37;1m\nExecution finished in " <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(0) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " seconds.\nFailed: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). failed <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Passed: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). passed <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (skipped ? " Skipped: " : "") <<cxx . . $ std/`operator<<`(88df5bef833f7f83). (skipped ? stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(3d81e17e7a87eecc).(skipped) : ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Percentage: " <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(2) <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). ((float)(passed) / (float)(passed + failed) * 100.0f) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "%\u001b[0m\n"; |
| 121 | return failed; |
| 122 | } |
| 123 | |
| 124 | namespacecxx . . $ `$anonymous_namespace_src/unittest/unittest.cpp`/ { |
| 125 | stdcxx . . $ std/::stringcxx . . $ std/string# get_testdata_dircxx . . $ `$anonymous_namespace_src/unittest/unittest.cpp`/get_testdata_dir(efd28698952f529a).() { |
| 126 | char *env_var = getenv("TEST_DATA_DIR"); |
| 127 | |
| 128 | return (cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).env_var ? env_var : "../../testdata/"); |
| 129 | } |
| 130 | } // namespace |
| 131 | |
| 132 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<uint8_tcxx . . $ uint8_t#> load_test_audiocxx . . $ load_test_audio(695134cc693f8bd0).() { |
| 133 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<uint8_tcxx . . $ uint8_t#> testaudiocxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 134 | stdcxx . . $ std/::stringcxx . . $ std/string# dir = get_testdata_dircxx . . $ `$anonymous_namespace_src/unittest/unittest.cpp`/get_testdata_dir(efd28698952f529a).(); |
| 135 | stdcxx . . $ std/::ifstreamcxx . . $ std/ifstream# inputcxx . . $ std/basic_ifstream#basic_ifstream(be6c264dafcf0985). (dir +cxx . . $ std/operator+(40fc1db9226233c6). "Robot.pcm", stdcxx . . $ std/::ioscxx . . $ std/ios#::incxx . . $ std/ios_base#in.|cxx . . $ std/`operator|`(2dd9eb40323da8bf).stdcxx . . $ std/::ioscxx . . $ std/ios#::binarycxx . . $ std/ios_base#binary.|cxx . . $ std/`operator|`(2dd9eb40323da8bf).stdcxx . . $ std/::ioscxx . . $ std/ios#::atecxx . . $ std/ios_base#ate.); |
| 136 | if (input.is_opencxx . . $ std/basic_ifstream#is_open(c9857a73d68e59ba).()) { |
| 137 | size_t testaudio_size = input.tellgcxx . . $ std/basic_istream#tellg(bf66e90edbd3e74a).(); |
| 138 | testaudio.resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(testaudio_size); |
| 139 | input.seekgcxx . . $ std/basic_istream#seekg(f79fad2892c4fe4).(0, stdcxx . . $ std/::ioscxx . . $ std/ios#::begcxx . . $ std/ios_base#beg.); |
| 140 | input.readcxx . . $ std/basic_istream#read(ec7d6f01d31dcb96).((char*)testaudio.datacxx . . $ std/vector#data(258ee1c9e0a18a5c).(), testaudio_size); |
| 141 | input.closecxx . . $ std/basic_ifstream#close(49f6e7a06ebc5aa8).(); |
| 142 | } |
| 143 | else { |
| 144 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). "ERROR: Can't load " +cxx . . $ std/operator+(42c652dfebe55ad7). dir +cxx . . $ std/operator+(900ec9581c410ad9). "Robot.pcm\n"; |
| 145 | exit(1); |
| 146 | } |
| 147 | return testaudiocxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 148 | } |
| 149 | |
| 150 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::bytecxx . . $ std/byte#> load_datacxx . . $ load_data(bfcd96bf31b7b509).(const stdcxx . . $ std/::stringcxx . . $ std/string#& file) { |
| 151 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::bytecxx . . $ std/byte#> testimagecxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 152 | stdcxx . . $ std/::stringcxx . . $ std/string# dir = get_testdata_dircxx . . $ `$anonymous_namespace_src/unittest/unittest.cpp`/get_testdata_dir(efd28698952f529a).(); |
| 153 | stdcxx . . $ std/::ifstreamcxx . . $ std/ifstream# inputcxx . . $ std/basic_ifstream#basic_ifstream(be6c264dafcf0985). (dir +cxx . . $ std/operator+(2764d1739bf7913d). file, stdcxx . . $ std/::ioscxx . . $ std/ios#::incxx . . $ std/ios_base#in.|cxx . . $ std/`operator|`(2dd9eb40323da8bf).stdcxx . . $ std/::ioscxx . . $ std/ios#::binarycxx . . $ std/ios_base#binary.|cxx . . $ std/`operator|`(2dd9eb40323da8bf).stdcxx . . $ std/::ioscxx . . $ std/ios#::atecxx . . $ std/ios_base#ate.); |
| 154 | if (input.is_opencxx . . $ std/basic_ifstream#is_open(c9857a73d68e59ba).()) { |
| 155 | size_t testimage_size = input.tellgcxx . . $ std/basic_istream#tellg(bf66e90edbd3e74a).(); |
| 156 | testimage.resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(testimage_size); |
| 157 | input.seekgcxx . . $ std/basic_istream#seekg(f79fad2892c4fe4).(0, stdcxx . . $ std/::ioscxx . . $ std/ios#::begcxx . . $ std/ios_base#beg.); |
| 158 | input.readcxx . . $ std/basic_istream#read(ec7d6f01d31dcb96).((char*)testimage.datacxx . . $ std/vector#data(258ee1c9e0a18a5c).(), testimage_size); |
| 159 | input.closecxx . . $ std/basic_ifstream#close(49f6e7a06ebc5aa8).(); |
| 160 | } |
| 161 | else { |
| 162 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). "ERROR: Can't load " +cxx . . $ std/operator+(42c652dfebe55ad7). dir +cxx . . $ std/operator+(db5dc2ea912c6495). file +cxx . . $ std/operator+(900ec9581c410ad9). "\n"; |
| 163 | exit(1); |
| 164 | } |
| 165 | return testimagecxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 166 | } |
| 167 | |
| 168 | stdcxx . . $ std/::stringcxx . . $ std/string# get_tokencxx . . $ get_token(efd28698952f529a).() { |
| 169 | char* t = getenv("DPP_UNIT_TEST_TOKEN"); |
| 170 | stdcxx . . $ std/::stringcxx . . $ std/string# tokcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 171 | if (!t) { |
| 172 | offlinecxx . . $ offline. = true; |
| 173 | } else { |
| 174 | tok =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(t); |
| 175 | if (tok.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 176 | offlinecxx . . $ offline. = true; |
| 177 | } |
| 178 | } |
| 179 | return tokcxx . . $ std/__cxx11/basic_string#basic_string(8f3aaafa33d05d0b).; |
| 180 | } |
| 181 | |
| 182 | void wait_for_testscxx . . $ wait_for_tests(49f6e7a06ebc5aa8).() { |
| 183 | uint16_tcxx . . $ uint16_t# ticks = 0; |
| 184 | while (ticks < TEST_TIMEOUTcxx . . $ TEST_TIMEOUT.) { |
| 185 | size_t finished = 0; |
| 186 | for (auto t : testscxx . . $ tests.) { |
| 187 | if (t->statuscxx . . $ test_t#status. != ts_startedcxx . . $ ts_started.) { |
| 188 | finished++; |
| 189 | } else if (is_skippedcxx . . $ is_skipped(b88c5c295d724553).(*t)) { |
| 190 | finished++; |
| 191 | t->statuscxx . . $ test_t#status. = ts_skippedcxx . . $ ts_skipped.; |
| 192 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[33mSKIPPED\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). tcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).->descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 193 | } |
| 194 | } |
| 195 | if (finished == testscxx . . $ tests..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) { |
| 196 | stdcxx . . $ std/::this_threadcxx . . $ std/this_thread/::sleep_forcxx . . $ std/this_thread/sleep_for(fb2140da9187dddf).(stdcxx . . $ std/::chronocxx . . $ std/chrono/::secondscxx . . $ std/chrono/seconds#(5)); |
| 197 | return; |
| 198 | } |
| 199 | stdcxx . . $ std/::this_threadcxx . . $ std/this_thread/::sleep_forcxx . . $ std/this_thread/sleep_for(fb2140da9187dddf).(stdcxx . . $ std/::chronocxx . . $ std/chrono/::secondscxx . . $ std/chrono/seconds#(1)); |
| 200 | ticks++; |
| 201 | } |
| 202 | for (auto t : testscxx . . $ tests.) { |
| 203 | if (t->statuscxx . . $ test_t#status. == ts_startedcxx . . $ ts_started.) { |
| 204 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::fixedcxx . . $ std/fixed(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(f54f2ca72cfad5a6). stdcxx . . $ std/::setprecisioncxx . . $ std/setprecision(94726062283fda89).(3) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). get_timecxx . . $ get_time(31fa7155c10fdd13).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[\u001b[31mTIMEOUT\u001b[0m] " <<cxx . . $ std/`operator<<`(cb6f908c4937f172). tcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).->descriptioncxx . . $ test_t#description. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 205 | } |
| 206 | } |
| 207 | } |