コード例 #1
0
void tst_movePlotCommand::check()
{
	QFETCH(double, Offset) ;
	QFETCH(double, Slope) ;
	QFETCH(double, Scale) ;
	QFETCH(double, Shift) ;

	specExchangeFilterCommand *command = new specExchangeFilterCommand(0) ;
	QVector<QPointF> data, newData ;
	for (size_t i = 0 ; i < itemA->dataSize() ; ++i)
		data << itemA->sample(i) ;
	for (int i = 0 ; i < data.size() ; ++i)
	{
		data[i].setX(data[i].x() + Shift) ;
		data[i].setY(data[i].y() * Scale + Offset + data[i].x() * Slope) ;
	}
	// Average data:
//	QVector<QPointF> ave ;
//	averageToNew(data.begin(), data.end(), xIsEqual, std::back_inserter(ave));
//	data.swap(ave) ;

	command->setParentObject(model) ;
	command->setItem(itemA) ;
	command->setRelativeFilter(specDataPointFilter(Offset, Slope, Scale, Shift));
	command->redo();
	itemA->revalidate();
	for (size_t i = 0 ; i < itemA->dataSize() ; ++i)
		newData << itemA->sample(i) ;
	command->undo();

//	QByteArray newModel ;
//	QDataStream out(&newModel, QIODevice::WriteOnly) ;
//	out << (specStreamable&) *model ;

	bool dataEqual = (data.size() == newData.size()) ;
//	QVector<QPointF> diffData ;
	for (int i = 0 ; i < qMin(data.size(), newData.size()) ; ++i)
	{
		if (!dataEqual) break ;
		const QPointF &sample = data[i],
				&newSample = newData[i] ;
		dataEqual = compareDoubles(sample.x(), newSample.x())
				&& compareDoubles(sample.y(), newSample.y()) ;
		qDebug() << sample << newSample << dataEqual ;
//		diffData << newSample - sample ;
	}

	if (!dataEqual)
	{
		qDebug() << "Offset, Slope, Scale, Shift:" << Offset << Slope << Scale << Shift ;
		qDebug() << "    Data:" << data ;
		qDebug() << "New Data:" << newData ;
//		qDebug() << "Diff:     " << diffData ;
		QCOMPARE(data, newData) ;
	}
//	QCOMPARE(savedModel, newModel) ;
}
コード例 #2
0
ファイル: driver.c プロジェクト: lonbon7/cpe101
void testUpdateVelocity()
{
    double velocity;

    printf("*** Testing updateVelocity... ***\n\n");

    /* Test 1: -1.0 and -0.5 */
    printf("TEST 1: Inputing -1 and -0.5\n");
    velocity = updateVelocity(-1.0, -0.5);
    printf("      Expect: %f\n", -1.5);
    printf("      Got: %f\n", velocity);
    /* Compare to see if output velocity and the expected are equal.
     * See the description of the compareDoubles function below. */
    if (compareDoubles(velocity, -1.5, .000001))
    {
        printf("      Pass\n");
    }
    else
    {
        printf("      FAIL\n");
    }

    /* Test 2: 0.0 and 0.0 */
    printf("TEST 2: Inputing 0.0 and 0.0\n");
    velocity = updateVelocity(0.0, 0.0);
    printf("      Expect: %f\n", 0.0);
    printf("      Got: %f\n", velocity);
    if (compareDoubles(velocity, 0.0, .000001))
    {
        printf("      Pass\n");
    }
    else
    {
        printf("      FAIL\n");
    }

    /* Test 3: -100.23 and 1.1 */
    printf("TEST 3: Inputing -100.23 and 1.1\n");
    velocity = updateVelocity(-100.23, 1.1);
    printf("      Expect: %f\n", -99.13);
    printf("      Got: %f\n", velocity);
    if (compareDoubles(velocity, -99.13, .000001))
    {
        printf("      Pass\n");
    }
    else
    {
        printf("      FAIL\n");
    }
}
コード例 #3
0
void GetFaceResourceTest::testFaces(const QString& fileName) {
    QString base = testResources + QDir::separator() + fileName;
    QFile file(base + ".jpg");
    QJsonDocument current;
    int status = faceResource->getJSONFaces(&file, current);
    file.close();
    QCOMPARE(HttpHeaders::STATUS_SUCCESS, status);

    QFile jsonFile(base + ".json");

    QVERIFY(jsonFile.exists());

    jsonFile.open(QIODevice::ReadOnly | QIODevice::Text);
    QJsonDocument expected = QJsonDocument().fromJson(jsonFile.readAll());
    jsonFile.close();

    QJsonArray currentArray = current.array();
    QJsonArray expectedArray = expected.array();

    // Make sure we're not comparing zero to zero
    QVERIFY(expectedArray.size() > 0);
    QCOMPARE(currentArray.size(), expectedArray.size());

    for (int i=0; i<currentArray.size(); ++i) {
        QJsonObject cFaceParts = currentArray[i].toObject();
        QJsonObject eFaceParts = expectedArray[i].toObject();

        QJsonObject cFace = eFaceParts["face"].toObject();
        QJsonObject eFace = eFaceParts["face"].toObject();
        compareDoubles(cFace["x1"].toDouble(), eFace["x1"].toDouble(), 0.0001);
        compareDoubles(cFace["x2"].toDouble(), eFace["x2"].toDouble(), 0.0001);
        compareDoubles(cFace["y1"].toDouble(), eFace["y1"].toDouble(), 0.0001);
        compareDoubles(cFace["y2"].toDouble(), eFace["y2"].toDouble(), 0.0001);

        QCOMPARE(cFaceParts["pose"], eFaceParts["pose"]);
        QCOMPARE(cFaceParts["model"], eFaceParts["model"]);

        QJsonObject cParts = cFaceParts["parts"].toObject();
        QJsonObject eParts = eFaceParts["parts"].toObject();

        QCOMPARE(cParts.size(), eParts.size());

        for (QJsonObject::const_iterator cIter = cParts.constBegin(); cIter != cParts.constEnd(); ++cIter) {
            QJsonArray cSubpart = cIter.value().toArray();
            QJsonArray eSubpart = cParts[cIter.key()].toArray();

            QCOMPARE(cSubpart.size(), eSubpart.size());

            for (int i=0; i<cSubpart.size(); ++i) {
                QJsonObject cPart = cSubpart[i].toObject();
                QJsonObject ePart = eSubpart[i].toObject();
                compareDoubles(cPart["x"].toDouble(), ePart["x"].toDouble(), 0.0001);
                compareDoubles(cPart["y"].toDouble(), ePart["y"].toDouble(), 0.0001);
                QCOMPARE(cPart["num"], ePart["num"]);
            }
        }
    }
}
コード例 #4
0
void LogicalSparseOpsUnitTest::compareFads(const DFadType& x_dfad,
					   const LSType& x_ls) {

  // Compare sizes
  CPPUNIT_ASSERT(x_dfad.size() == x_ls.size());
  
  // Compare hasFastAccess
  CPPUNIT_ASSERT(x_dfad.hasFastAccess() == x_ls.hasFastAccess());
  
  // Compare values
  compareDoubles(x_dfad.val(), x_ls.val());
  
  for (int i=0; i<x_ls.size(); i++) {
    
    // Compare dx
    compareDx(x_dfad.dx(i), x_ls.dx(i));
    
    // Compare fastAccessDx
    compareDx(x_dfad.fastAccessDx(i), x_ls.fastAccessDx(i));
  }
}
コード例 #5
0
ファイル: source.c プロジェクト: gitNoo/Pricer
void main(int argc, char** argvs)
{
	struct NODE* listBuy	= NULL;
	struct NODE* listSell	= NULL;
	FILE* fileIn	= NULL;
	FILE* fileOut	= NULL;
	char strLine[BUFFER];
	int iTargetSize = 0;

	char* strCommand;
	char* strOderID;
	char* strSide;
	int iTime;
	double dPrice;
	int iSize;

	double dTotalB = 0;
	double dTotalS = 0;


	/**
	*	Check arguments, if number of arguments is wrong then
	*	print help and return.
	*/
	if (argc != 4)
	{
		printf("The Pricer program using 3 arguments:\n");
		printf("<target-size> <file-in> <file-out>\n");
		return;
	}

	fileIn = fopen(argvs[2], "r");

	if (fileIn)
	{
		iTargetSize = atoi(argvs[1]);
		fileOut = fopen(argvs[3], "w");
		while (!feof(fileIn))
		{
			strLine[0] = NULL;//Clear line before get new line;
			fgets(strLine, BUFFER, fileIn);
			if (strlen(strLine) == 0)
				break;

			char* context = NULL;

			iTime = atoi(strtok(strLine, " "));
			strCommand	= strtok(NULL, " ");
			strOderID	= strtok(NULL, " ");

			//Handle for command 'A' Add Order to Book
			if (strcmp(strCommand, "A")==0)
			{
				strSide	= strtok(NULL, " ");
				dPrice = toDouble(strtok(NULL, " "));
				iSize = atoi(strtok(NULL, " "));
				
				//Add Order to Book by side 'B'
				if (strcmp(strSide, "B") == 0)
				{
					addList(&listBuy, makeNode(strOderID, dPrice, iSize), false);
					double dTotal = getTotal(listBuy, iTargetSize);
					if (dTotal > 0)
					{
						if (!compareDoubles(dTotal, dTotalS))
						{
							dTotalS = dTotal;
							printf("%d S %0.2f\n", iTime, dTotalS);
							fprintf(fileOut, "%d S %0.2f\n", iTime, dTotalS);
						}
					}
				}
				//Add Order to Book by side 'S'
				else if (strcmp(strSide, "S") == 0)
				{
					addList(&listSell, makeNode(strOderID, dPrice, iSize), true);
					double dTotal = getTotal(listSell, iTargetSize);
					if (dTotal > 0)
					{
						if (!compareDoubles(dTotal, dTotalB))
						{
							dTotalB = dTotal;
							printf("%d B %0.2f\n", iTime, dTotalB);
							fprintf(fileOut, "%d B %0.2f\n", iTime, dTotalB);
						}
					}
				}
			}
			//Handle for command 'R' Add Order to Book
			else if (strcmp(strCommand, "R") == 0)
			{
				iSize = atoi(strtok(NULL, " "));
				if (reduceSize(&listBuy, strOderID, iSize))
				{
					double dTotal = getTotal(listBuy, iTargetSize);
					if (dTotal > 0)
					{
						if (!compareDoubles(dTotalS, dTotal))
						{
							dTotalS = dTotal;
							printf("%d S %0.2f\n", iTime, dTotalS);
							fprintf(fileOut, "%d S %0.2f\n", iTime, dTotalS);
						}
					}
					else if (dTotalS > 0)
					{
						printf("%d S NA\n", iTime);
						fprintf(fileOut, "%d S NA\n", iTime);
						dTotalS = 0;
					}
				}

				if (reduceSize(&listSell, strOderID, iSize))
				{
					double dTotal = getTotal(listSell, iTargetSize);
					if (dTotal > 0)
					{
						if (!compareDoubles(dTotalB, dTotal))
						{
							dTotalB = dTotal;
							printf("%d B %0.2f\n", iTime, dTotalB);
							fprintf(fileOut, "%d B %0.2f\n", iTime, dTotalB);
						}
					}
					else if (dTotalB > 0)
					{
						printf("%d B NA\n", iTime);
						fprintf(fileOut,"%d B NA\n", iTime);
						dTotalB = 0;
					}

				}
			}
		}
		fclose(fileIn);
		fclose(fileOut);

		removeList(listBuy);
		removeList(listSell);
	}
	else
	{
		printf("Could not find file: %s\n", argvs[2]);
		return;
	}
}
コード例 #6
0
void LogicalSparseOpsUnitTest::testMin() {
  double val;

  // LFad, LFad
  LSType aa_ls = a_ls - 1.0;
  c_ls = min(aa_ls, a_ls);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }
  c_ls = min(a_ls, aa_ls);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }

  // Expr, LFad
  c_ls = min(a_ls-1.0, a_ls);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }
  c_ls = min(a_ls, a_ls-1.0);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }

  // Expr, Expr (same)
  c_ls = min(a_ls-1.0, a_ls-1.0);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }

  // Expr, Expr (different)
  c_ls = min(a_ls+1.0, a_ls-1.0);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }
  c_ls = min(a_ls-1.0, a_ls+1.0);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }

  // LFad, const
  val = a_ls.val() - 1;
  c_ls = min(a_ls, val);
  compareDoubles(c_ls.val(), val);
  for (int i=0; i<n; i++)
    compareBools(c_ls.dx(i), 0);
  val = a_ls.val() + 1;
  c_ls = min(a_ls, val);
  compareDoubles(c_ls.val(), a_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), a_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), a_ls.fastAccessDx(i));
  }
  val = b_ls.val() - 1;
  c_ls = min(val, b_ls);
  compareDoubles(c_ls.val(), val);
  for (int i=0; i<n; i++)
    compareBools(c_ls.dx(i), 0);
  val = b_ls.val() + 1;
  c_ls = min(val, b_ls);
  compareDoubles(c_ls.val(), b_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), b_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), b_ls.fastAccessDx(i));
  }

  // Expr, const
  val = a_ls.val();
  c_ls = min(a_ls-1.0, val);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }
  c_ls = min(val, a_ls-1.0);
  compareDoubles(c_ls.val(), aa_ls.val());
  for (int i=0; i<n; i++) {
    compareBools(c_ls.dx(i), aa_ls.dx(i));
    compareBools(c_ls.fastAccessDx(i), aa_ls.fastAccessDx(i));
  }
}
コード例 #7
0
int BSONElement::compareElements(const BSONElement& l,
                                 const BSONElement& r,
                                 ComparisonRulesSet rules,
                                 const StringData::ComparatorInterface* comparator) {
    switch (l.type()) {
        case BSONType::EOO:
        case BSONType::Undefined:  // EOO and Undefined are same canonicalType
        case BSONType::jstNULL:
        case BSONType::MaxKey:
        case BSONType::MinKey: {
            auto f = l.canonicalType() - r.canonicalType();
            if (f < 0)
                return -1;
            return f == 0 ? 0 : 1;
        }
        case BSONType::Bool:
            return *l.value() - *r.value();
        case BSONType::bsonTimestamp:
            // unsigned compare for timestamps - note they are not really dates but (ordinal +
            // time_t)
            if (l.timestamp() < r.timestamp())
                return -1;
            return l.timestamp() == r.timestamp() ? 0 : 1;
        case BSONType::Date:
            // Signed comparisons for Dates.
            {
                const Date_t a = l.Date();
                const Date_t b = r.Date();
                if (a < b)
                    return -1;
                return a == b ? 0 : 1;
            }

        case BSONType::NumberInt: {
            // All types can precisely represent all NumberInts, so it is safe to simply convert to
            // whatever rhs's type is.
            switch (r.type()) {
                case NumberInt:
                    return compareInts(l._numberInt(), r._numberInt());
                case NumberLong:
                    return compareLongs(l._numberInt(), r._numberLong());
                case NumberDouble:
                    return compareDoubles(l._numberInt(), r._numberDouble());
                case NumberDecimal:
                    return compareIntToDecimal(l._numberInt(), r._numberDecimal());
                default:
                    MONGO_UNREACHABLE;
            }
        }

        case BSONType::NumberLong: {
            switch (r.type()) {
                case NumberLong:
                    return compareLongs(l._numberLong(), r._numberLong());
                case NumberInt:
                    return compareLongs(l._numberLong(), r._numberInt());
                case NumberDouble:
                    return compareLongToDouble(l._numberLong(), r._numberDouble());
                case NumberDecimal:
                    return compareLongToDecimal(l._numberLong(), r._numberDecimal());
                default:
                    MONGO_UNREACHABLE;
            }
        }

        case BSONType::NumberDouble: {
            switch (r.type()) {
                case NumberDouble:
                    return compareDoubles(l._numberDouble(), r._numberDouble());
                case NumberInt:
                    return compareDoubles(l._numberDouble(), r._numberInt());
                case NumberLong:
                    return compareDoubleToLong(l._numberDouble(), r._numberLong());
                case NumberDecimal:
                    return compareDoubleToDecimal(l._numberDouble(), r._numberDecimal());
                default:
                    MONGO_UNREACHABLE;
            }
        }

        case BSONType::NumberDecimal: {
            switch (r.type()) {
                case NumberDecimal:
                    return compareDecimals(l._numberDecimal(), r._numberDecimal());
                case NumberInt:
                    return compareDecimalToInt(l._numberDecimal(), r._numberInt());
                case NumberLong:
                    return compareDecimalToLong(l._numberDecimal(), r._numberLong());
                case NumberDouble:
                    return compareDecimalToDouble(l._numberDecimal(), r._numberDouble());
                default:
                    MONGO_UNREACHABLE;
            }
        }

        case BSONType::jstOID:
            return memcmp(l.value(), r.value(), OID::kOIDSize);
        case BSONType::Code:
            return compareElementStringValues(l, r);
        case BSONType::Symbol:
        case BSONType::String: {
            if (comparator) {
                return comparator->compare(l.valueStringData(), r.valueStringData());
            } else {
                return compareElementStringValues(l, r);
            }
        }
        case BSONType::Object:
        case BSONType::Array: {
            return l.embeddedObject().woCompare(
                r.embeddedObject(),
                BSONObj(),
                rules | BSONElement::ComparisonRules::kConsiderFieldName,
                comparator);
        }
        case BSONType::DBRef: {
            int lsz = l.valuesize();
            int rsz = r.valuesize();
            if (lsz - rsz != 0)
                return lsz - rsz;
            return memcmp(l.value(), r.value(), lsz);
        }
        case BSONType::BinData: {
            int lsz = l.objsize();  // our bin data size in bytes, not including the subtype byte
            int rsz = r.objsize();
            if (lsz - rsz != 0)
                return lsz - rsz;
            return memcmp(l.value() + 4, r.value() + 4, lsz + 1 /*+1 for subtype byte*/);
        }
        case BSONType::RegEx: {
            int c = strcmp(l.regex(), r.regex());
            if (c)
                return c;
            return strcmp(l.regexFlags(), r.regexFlags());
        }
        case BSONType::CodeWScope: {
            int cmp = StringData(l.codeWScopeCode(), l.codeWScopeCodeLen() - 1)
                          .compare(StringData(r.codeWScopeCode(), r.codeWScopeCodeLen() - 1));
            if (cmp)
                return cmp;

            // When comparing the scope object, we should consider field names. Special string
            // comparison semantics do not apply to strings nested inside the CodeWScope scope
            // object, so we do not pass through the string comparator.
            return l.codeWScopeObject().woCompare(
                r.codeWScopeObject(),
                BSONObj(),
                rules | BSONElement::ComparisonRules::kConsiderFieldName);
        }
    }

    MONGO_UNREACHABLE;
}
コード例 #8
0
ファイル: evaluate.c プロジェクト: shivdasgujare/evlog
/*
 * opnode is the root of a comparison with a non-standard attribute.
 * Evaluate the comparison, returning 1 (true) or 0 (false).
 */
static int
evaluateNonStdComparison(const pnode_t *opnode, evlattribute_t *tmplAtts[])
{
	const pnode_t *left = pnLeft(opnode);
	const pnode_t *right = pnRight(opnode);
	int op = opnode->attr_flag;
	evlattribute_t *att;
	long sval;
	int attType;

	if (!tmplAtts) {
		return 0;
	}
	att = tmplAtts[left->attr_nsa->nsaAtt];
	if (!att || !attExists(att)) {
		return 0;
	}

	if (right->node_type == nt_string || right->node_type == nt_regex) {
		/*
		 * Get the string equivalent of the attribute value, for
		 * comparison either via strstr or via regexec.
		 */
		char leftStr[EVL_ATTRSTR_MAXLEN];
		int status;

		status = evlatt_getstring(att, leftStr, EVL_ATTRSTR_MAXLEN);
		assert(status == 0);

		if (right->node_type == nt_string) {
			const char *rightStr = right->u_att.attr_string;
			return compareStrings(op, leftStr, rightStr);
		} else {
			status = regexec(right->u_att.attr_regex, leftStr,
				0, NULL, 0);
			if (op == '~') {
				return (status == 0);
			} else {
				/* Must be !~ */
				return (status != 0);
			}
		}
	}

	assert(right->node_type == nt_val);
	sval = (long) right->u_att.attr_val;
	
	switch(evlatt_gettype(att)) {
	case TY_CHAR:
	case TY_WCHAR:
	case TY_SHORT:
	case TY_INT:
	case TY_LONG:
		return compareSignedInts(op, evl_getLongAttVal(att), sval);
	case TY_UCHAR:
	case TY_USHORT:
	case TY_UINT:
	case TY_ULONG:
		return compareUnsignedInts(op, evl_getUlongAttVal(att), sval);
	case TY_LONGLONG:
		return compareLonglongs(op, evl_getLonglongAttVal(att), sval);
	case TY_ULONGLONG:
		return compareUlonglongs(op, evl_getUlonglongAttVal(att), sval);
	case TY_FLOAT:
	case TY_DOUBLE:
		return compareDoubles(op, evl_getDoubleAttVal(att), sval);
	case TY_LDOUBLE:
		return compareLongdoubles(op, evl_getLongdoubleAttVal(att), sval);
	}
	
	/* TODO: Handle unsupported types such as TY_WSTRING. */
	return 0;
}
コード例 #9
0
void BytecodeGenerationVisitor::visitBinaryOpNode(BinaryOpNode* node) {
	node -> right() -> visit(this);
	VarType secondType = currentType;
	node -> left() -> visit(this);
	VarType firstType = currentType;

	VarType commonType;
	if (secondType == firstType && (firstType == VT_INT || firstType == VT_DOUBLE)) {
		commonType = firstType;
	} else if (firstType == VT_DOUBLE && secondType == VT_INT) {
		bytecode -> addInsn(BC_SWAP);
		bytecode -> addInsn(BC_I2D);
		bytecode -> addInsn(BC_SWAP);
		commonType = VT_DOUBLE;
	} else if (secondType == VT_DOUBLE && firstType == VT_INT) {
		bytecode -> addInsn(BC_I2D);
		commonType = VT_DOUBLE;
	} else {
		throw std::exception();
	}

	TokenKind op = node -> kind();
	switch (op) {
		case tRANGE:
			if (commonType == VT_INT) {
				currentType = VT_VOID;
				return;
			} else {
				throw std::exception();
			}

		case tADD:
		case tSUB:
		case tMUL:
		case tDIV:
		case tMOD: {
			if (insnByToken[commonType].find(op) == insnByToken[commonType].end()) {
				throw std::exception();
			}
			Instruction ins = insnByToken[commonType][op];
			bytecode -> addInsn(ins);
			currentType = commonType;
			break;
		}

		case tAND:
			if (commonType != VT_INT) {
				throw std::exception();
			}
			AND();
			currentType = VT_INT;
			break;
		case tOR:
			if (commonType != VT_INT) {
				throw std::exception();
			}
			OR();
			currentType = VT_INT;
			break;

		case tEQ:
		case tNEQ:
		case tGT:
		case tGE:
		case tLT:
		case tLE:
			if (commonType == VT_INT) {
				compareInts(insnByToken[VT_INT][op]);
			} else if (commonType == VT_DOUBLE) {
				compareDoubles(insnByToken[VT_INT][op]);
			}
			currentType = VT_INT;
			break;
		default:
			throw std::exception();
	}
}