本文整理汇总了C++中passed函数的典型用法代码示例。如果您正苦于以下问题:C++ passed函数的具体用法?C++ passed怎么用?C++ passed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了passed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Do_Test2
// This function performs basic drop tests, testing a data object consisting of
// two transferables.
nsresult Do_Test2()
{
nsresult rv = NS_OK;
nsresult workingrv;
workingrv = Do_CheckTwoFiles();
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on multiple files");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully created a working multiple file drag object!");
}
workingrv = Do_CheckTwoStrings();
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on multiple strings");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully created a working multiple string drag object!");
}
workingrv = Do_CheckSetArbitraryData(true);
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on setting arbitrary data");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully set arbitrary data on a drag object");
}
return rv;
}
示例2: Do_Test1
// This function performs basic drop tests, testing a data object consisting
// of one transferable
nsresult Do_Test1()
{
nsresult rv = NS_OK;
nsresult workingrv;
workingrv = Do_CheckOneFile();
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on a single file");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully created a working file drag object!");
}
workingrv = Do_CheckOneString();
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on a single string");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully created a working string drag object!");
}
workingrv = Do_CheckSetArbitraryData(false);
if (NS_FAILED(workingrv)) {
fail("Drag object tests failed on setting arbitrary data");
rv = NS_ERROR_UNEXPECTED;
} else {
passed("Successfully set arbitrary data on a drag object");
}
return rv;
}
示例3: SendNoReturn
void
TestAsyncReturnsParent::Main()
{
SendNoReturn()->Then(MessageLoop::current()->SerialEventTarget(), __func__,
[](bool unused) {
fail("resolve handler should not be called");
},
[](PromiseRejectReason aReason) {
// MozPromise asserts in debug build if the
// handler is not called
if (aReason != PromiseRejectReason::ChannelClosed) {
fail("reject with wrong reason");
}
passed("reject handler called on channel close");
});
SendPing()->Then(MessageLoop::current()->SerialEventTarget(), __func__,
[this](bool one) {
if (one) {
passed("take one argument");
} else {
fail("get one argument but has wrong value");
}
Close();
},
[](PromiseRejectReason aReason) {
fail("sending Ping");
});
}
示例4: passed
NS_IMETHODIMP
UDPClientListener::OnPacketReceived(nsIUDPSocket* socket, nsIUDPMessage* message)
{
mResult = NS_OK;
uint16_t port;
nsCString ip;
nsCOMPtr<nsINetAddr> fromAddr;
message->GetFromAddr(getter_AddRefs(fromAddr));
fromAddr->GetPort(&port);
fromAddr->GetAddress(ip);
passed("Packet received on client from %s:%d", ip.get(), port);
if (TEST_SEND_API == phase && CheckMessageContent(message, REQUEST)) {
uint32_t count;
const uint32_t data = RESPONSE;
printf("*** Attempting to write response 0x%x to server by SendWithAddr...\n", RESPONSE);
mResult = socket->SendWithAddr(fromAddr, (const uint8_t*)&data,
sizeof(uint32_t), &count);
if (mResult == NS_OK && count == sizeof(uint32_t)) {
passed("Response written");
} else {
fail("Response written");
}
return NS_OK;
} else if (TEST_OUTPUT_STREAM != phase || !CheckMessageContent(message, RESPONSE)) {
mResult = NS_ERROR_FAILURE;
}
// Notify thread
QuitPumpingEvents();
return NS_OK;
}
示例5: passed
NS_IMETHODIMP
UDPListener::OnPacketReceived(nsIUDPServerSocket* socket, nsIUDPMessage* message)
{
mResult = NS_OK;
uint16_t port;
nsCString ip;
nsCOMPtr<nsINetAddr> fromAddr;
message->GetFromAddr(getter_AddRefs(fromAddr));
fromAddr->GetPort(&port);
fromAddr->GetAddress(ip);
passed("Packet received on server from %s:%d", ip.get(), port);
nsCString data;
message->GetData(data);
const char* buffer = data.get();
uint32_t len = data.Length();
uint32_t input = 0;
for (uint32_t i = 0; i < len; i++) {
input += buffer[i] << (8 * i);
}
if (len != sizeof(uint32_t) || input != REQUEST)
{
mResult = NS_ERROR_FAILURE;
fail("Request 0x%x received on server", input);
} else {
passed("Request 0x%x received on server", input);
// Respond with same data
nsCOMPtr<nsIOutputStream> outstream;
message->GetOutputStream(getter_AddRefs(outstream));
uint32_t count;
const uint32_t data = RESPONSE;
printf("*** Attempting to write response 0x%x to client ...\n", RESPONSE);
mResult = outstream->Write((const char*)&data, sizeof(uint32_t), &count);
if (mResult == NS_OK && count == sizeof(uint32_t)) {
passed("Response written");
} else {
fail("Response written");
}
}
// Notify thread
QuitPumpingEvents();
return NS_OK;
}
示例6: eventSort
/*
* eventSort()
*
* This helps sort a list of events (a type implementation) based on how soon
* each event is to occur.
*/
static int eventSort(EVENT *s1, EVENT *s2)
{
if (during(s1) && during(s2))
return s1->EvMinutes - s2->EvMinutes;
if (during(s1)) return -1;
if (during(s2)) return 1;
if ((passed(s1) && passed(s2)) ||
(!passed(s1) && !passed(s2)))
return s1->EvMinutes - s2->EvMinutes;
return (s2->EvMinutes - s1->EvMinutes);
}
示例7: hysteresis16
static void hysteresis16(HysteresisContext *s, const uint8_t *bbsrc, const uint8_t *aasrc,
uint8_t *ddst,
ptrdiff_t blinesize, ptrdiff_t alinesize,
ptrdiff_t dlinesize,
int w, int h)
{
const uint16_t *bsrc = (const uint16_t *)bbsrc;
const uint16_t *asrc = (const uint16_t *)aasrc;
uint16_t *dst = (uint16_t *)ddst;
const int t = s->threshold;
int x, y;
blinesize /= 2;
alinesize /= 2;
dlinesize /= 2;
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
if ((bsrc[x + y * blinesize] > t) && (asrc[x + y * alinesize] > t) && !passed(s, x, y, w)) {
int posx, posy;
dst[x + y * dlinesize] = asrc[x + y * alinesize];
push(s, x, y, w);
while (!is_empty(s)) {
int x_min, x_max, y_min, y_max, yy, xx;
pop(s, &posx, &posy);
x_min = posx > 0 ? posx - 1 : 0;
x_max = posx < w - 1 ? posx + 1 : posx;
y_min = posy > 0 ? posy - 1 : 0;
y_max = posy < h - 1 ? posy + 1 : posy;
for (yy = y_min; yy <= y_max; yy++) {
for (xx = x_min; xx <= x_max; xx++) {
if ((asrc[xx + yy * alinesize] > t) && !passed(s, xx, yy, w)) {
dst[xx + yy * dlinesize] = asrc[xx + yy * alinesize];
push(s, xx, yy, w);
}
}
}
}
}
}
}
}
示例8: passed
void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) {
// First look it up in the pending messages and fast return, it'll be covered
// by processQueue().
for (auto it = m_queue.begin(); it != m_queue.end(); ++it) {
if (!(*it)->isCollected() && (*it)->hasPromise(data.GetPromise())) {
m_queue.remove(it);
return;
}
}
// Then look it up in the reported errors.
for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) {
std::unique_ptr<Message>& message = m_reportedAsErrors.at(i);
if (!message->isCollected() && message->hasPromise(data.GetPromise())) {
message->makePromiseStrong();
Platform::current()
->currentThread()
->scheduler()
->timerTaskRunner()
->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::revokeNow,
RefPtr<RejectedPromises>(this),
passed(std::move(message))));
m_reportedAsErrors.remove(i);
return;
}
}
}
示例9: TestJemallocUsableSizeInAdvance
static nsresult
TestJemallocUsableSizeInAdvance()
{
#define K * 1024
#define M * 1024 * 1024
/*
* Test every size up to a certain point, then (N-1, N, N+1) triplets for a
* various sizes beyond that.
*/
for (size_t n = 0; n < 16 K; n++)
if (!TestOne(n))
return NS_ERROR_UNEXPECTED;
for (size_t n = 16 K; n < 1 M; n += 4 K)
if (!TestThree(n))
return NS_ERROR_UNEXPECTED;
for (size_t n = 1 M; n < 8 M; n += 128 K)
if (!TestThree(n))
return NS_ERROR_UNEXPECTED;
passed("malloc_good_size");
return NS_OK;
}
示例10: while
void DataConsumerHandleTestUtil::HandleTwoPhaseReader::didGetReadable() {
WebDataConsumerHandle::Result r = WebDataConsumerHandle::UnexpectedError;
while (true) {
const void* buffer = nullptr;
size_t size;
r = m_reader->beginRead(&buffer, WebDataConsumerHandle::FlagNone, &size);
if (r == WebDataConsumerHandle::ShouldWait)
return;
if (r != WebDataConsumerHandle::Ok)
break;
// Read smaller than available in order to test |endRead|.
size_t readSize =
std::min(size, std::max(size * 2 / 3, static_cast<size_t>(1)));
m_data.append(static_cast<const char*>(buffer), readSize);
m_reader->endRead(readSize);
}
std::unique_ptr<HandleReadResult> result =
wrapUnique(new HandleReadResult(r, m_data));
m_data.clear();
Platform::current()->currentThread()->getWebTaskRunner()->postTask(
BLINK_FROM_HERE,
WTF::bind(&HandleTwoPhaseReader::runOnFinishedReading,
WTF::unretained(this), passed(std::move(result))));
m_reader = nullptr;
}
示例11: main
int main()
{
float *Ad;
hipMalloc((void**)&Ad, 1024);
// Test the different hipLaunchParm options:
hipLaunchKernel(vAdd, size_t(1024), 1, 0, 0, Ad);
hipLaunchKernel(vAdd, 1024, dim3(1), 0, 0, Ad);
hipLaunchKernel(vAdd, dim3(1024), 1, 0, 0, Ad);
hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad);
// Test case with hipLaunchKernel inside another macro:
float e0;
GPU_PRINT_TIME (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), e0, j);
GPU_PRINT_TIME (WRAP(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
#ifdef EXTRA_PARENS_1
// Don't wrap hipLaunchKernel in extra set of parens:
GPU_PRINT_TIME ((hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
#endif
MY_LAUNCH (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
float *A;
float e1;
MY_LAUNCH_WITH_PAREN (hipMalloc(&A, 100), true, "launch2");
#ifdef EXTRA_PARENS_2
//MY_LAUNCH_WITH_PAREN wraps cmd in () which can cause issues.
MY_LAUNCH_WITH_PAREN (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
#endif
passed();
}
示例12: main
int main(int argc, char *argv[])
{
HipTest::parseStandardArguments(argc, argv, true);
// Serial version, just call once:
if (p_tests & 0x1) {
printf ("\ntest 0x1 : serial createThenDestroyStreams(10) \n");
createThenDestroyStreams(10, 10);
};
/*disable, this takess a while and if the next one works then no need to run serial*/
if (1 && (p_tests & 0x2)) {
printf ("\ntest 0x2 : serialized multiThread_pyramid(1) \n");
multiThread_pyramid(true, 3);
}
if (p_tests & 0x4) {
printf ("\ntest 0x4 : parallel multiThread_pyramid(1) \n");
multiThread_pyramid(false, 3);
}
//if (p_tests & 0x8) {
// printf ("test 0x8 : multiThread_pyramid(100) \n");
// multiThread_pyramid(false, 100);
// }
if (p_tests & 0x10) {
printf ("\ntest 0x10 : parallel multiThread_nearzero(1000) \n");
multiThread_nearzero(false, 1000);
}
passed();
}
示例13: updateMeanData
void
MSCalibrator::writeXMLOutput() {
if (myOutput != nullptr) {
updateMeanData();
const int p = passed();
// meandata will be off if vehicles are removed on the next edge instead of this one
const int discrepancy = myEdgeMeanData.nVehEntered + myEdgeMeanData.nVehDeparted - myEdgeMeanData.nVehVaporized - passed();
assert(discrepancy >= 0);
const std::string ds = (discrepancy > 0 ? "\" vaporizedOnNextEdge=\"" + toString(discrepancy) : "");
const double durationSeconds = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin);
(*myOutput) << " <interval begin=\"" << time2string(myCurrentStateInterval->begin) <<
"\" end=\"" << time2string(myCurrentStateInterval->end) <<
"\" id=\"" << myID <<
"\" nVehContrib=\"" << p <<
"\" removed=\"" << myRemoved <<
"\" inserted=\"" << myInserted <<
"\" cleared=\"" << myClearedInJam <<
"\" flow=\"" << p * 3600.0 / durationSeconds <<
"\" aspiredFlow=\"" << myCurrentStateInterval->q <<
"\" speed=\"" << myEdgeMeanData.getTravelledDistance() / myEdgeMeanData.getSamples() <<
"\" aspiredSpeed=\"" << myCurrentStateInterval->v <<
ds << //optional
"\"/>\n";
}
myDidSpeedAdaption = false;
myInserted = 0;
myRemoved = 0;
myClearedInJam = 0;
myHaveWarnedAboutClearingJam = false;
reset();
}
示例14: TestCJKWithDisallowLineBreaking
// Test for CJK with DisallowLineBreaking
nsresult
TestCJKWithDisallowLineBreaking()
{
nsString test;
nsString result;
test.AssignLiteral("<html><body>");
for (uint32_t i = 0; i < 400; i++) {
// Insert Kanji (U+5341)
test.Append(0x5341);
}
test.AppendLiteral("</body></html>");
ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted |
nsIDocumentEncoder::OutputCRLineBreak |
nsIDocumentEncoder::OutputLFLineBreak |
nsIDocumentEncoder::OutputFormatFlowed |
nsIDocumentEncoder::OutputDisallowLineBreaking);
// create result case
for (uint32_t i = 0; i < 400; i++) {
result.Append(0x5341);
}
result.AppendLiteral("\r\n");
if (!test.Equals(result)) {
fail("Wrong HTML to CJK text serialization with OutputDisallowLineBreaking");
return NS_ERROR_FAILURE;
}
passed("HTML to CJK text serialization with OutputDisallowLineBreaking");
return NS_OK;
}
示例15: TestASCIIWithFlowedDelSp
// Test for ASCII with format=flowed; delsp=yes
nsresult
TestASCIIWithFlowedDelSp()
{
nsString test;
nsString result;
test.AssignLiteral("<html><body>"
"Firefox Firefox Firefox Firefox "
"Firefox Firefox Firefox Firefox "
"Firefox Firefox Firefox Firefox"
"</body></html>");
ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted |
nsIDocumentEncoder::OutputCRLineBreak |
nsIDocumentEncoder::OutputLFLineBreak |
nsIDocumentEncoder::OutputFormatFlowed |
nsIDocumentEncoder::OutputFormatDelSp);
// create result case
result.AssignLiteral("Firefox Firefox Firefox Firefox "
"Firefox Firefox Firefox Firefox "
"Firefox \r\nFirefox Firefox Firefox\r\n");
if (!test.Equals(result)) {
fail("Wrong HTML to ASCII text serialization with format=flowed; delsp=yes");
return NS_ERROR_FAILURE;
}
passed("HTML to ASCII text serialization with format=flowed; delsp=yes");
return NS_OK;
}