예제 #1
0
EXPORT_C TVerdict RAsyncTestStep::CheckTestResult()
	{
	TVerdict result = Result();
	
	if (result!=EPass) // if the result is a Pass, even if error is too we treat as test pass
		{
		INFO_PRINTF3(_L("Failed test with error %d, result %s"), Reason(), KVerdictString[result]);
		}
	return result;
	}
예제 #2
0
Disconnect *Disconnect::deserialize(uint8_t ctx, const uchar *data, uint len)
{
    if(len<1)
        return 0;
    return new Disconnect(ctx, Reason(*data), QByteArray((const char*)data+1, len-1));
}
예제 #3
0
파일: element.c 프로젝트: geoffchu/chuffed
	bool propagate() {

		// propagate holes in y
		for (int v = y.getMin(); v <= y.getMax(); v++) {
			if (!y.indomain(v)) continue;
			assert(num_support[v] > 0);
			int *s = support[v];
			if (x.indomain(s[0]) && a[s[0]].indomain(v)) continue;
			int f = 0;
			while (!(x.indomain(s[f]) && a[s[f]].indomain(v)) && ++f < num_support[v]);
			if (f == num_support[v]) {
				// v has no support, remove from y
				Clause* r = NULL;
				if (so.lazy) {
					r = Reason_new(x.getMax() + 4 - x.getMin());
					(*r)[1] = x.getMinLit();
					(*r)[2] = x.getMaxLit();
					for (int i = x.getMin(); i <= x.getMax(); i++) {
						//(*r)[3 + i - x.getMin()] = x.indomain(i) ? ~a[i].getLit(v, 0) : ~x.getLit(i, 0);
						int reasonIndex = 3 + i - x.getMin();
						if(x.indomain(i))
						{
							Lit l = ~a[i].getLit(v, 0);
							(*r)[reasonIndex] = l;
						}
						else
						{
							Lit l = ~x.getLit(i, 0);
						 	(*r)[reasonIndex] = l;
						}
					}
				}
				if (!y.remVal(v, r)) return false;
			} else {
				// shift bad supports to back
				for (int i = 0; i < f; i++) temp_sup[i] = s[i];
				for (int i = f; i < num_support[v]; i++) {
					s[i-f] = s[i];
				}
				s += num_support[v] - f;
				for (int i = 0; i < f; i++) s[i] = temp_sup[i];
				num_support[v] -= f;
			}
		}

		// propagate holes in x
		// just ignore

		// propagate holes in a_i
		if (x.isFixed()) {
			int v = x.getVal();
			IntView<W>& f = a[v];
			setDom(y, setMin, f.getMin(), f.getMinLit(), x.getValLit());
			setDom(f, setMin, y.getMin(), y.getMinLit(), x.getValLit());
			setDom(y, setMax, f.getMax(), f.getMaxLit(), x.getValLit());
			setDom(f, setMax, y.getMax(), y.getMaxLit(), x.getValLit());
			for (typename IntView<W>::iterator i = a[v].begin(); i != a[v].end(); ) {
				int w = *i++;
				if (!y.indomain(w) && !a[v].remVal(w, so.lazy ? Reason(~y.getLit(w, 0), ~x.getLit(v, 1)) : Reason()))
					return false;
			}
		}

		return true;
	}