Beispiel #1
0
void test_otrl_init(void)
{
	extern unsigned int otrl_api_version;

	const unsigned int expected = rand();
	otrl_api_version = expected;
	ok(otrl_init(OTRL_VERSION_MAJOR+1, 0, 0) == gcry_error(GPG_ERR_INV_VALUE),
			"Too recent major version");
	ok(otrl_api_version == expected, "Api number unchanged");

	ok(otrl_init(OTRL_VERSION_MAJOR-1, 0, 0) == gcry_error(GPG_ERR_INV_VALUE),
			"Too old major version");
	ok(otrl_api_version == expected, "Api number unchanged");

	ok(otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR+1, 0) == gcry_error(GPG_ERR_INV_VALUE), 
			"Too recent minor version");
	ok(otrl_api_version = expected, "Api number unchanged");

	ok(otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR?OTRL_VERSION_MINOR-1:0, OTRL_VERSION_SUB) == 
			gcry_error(GPG_ERR_NO_ERROR), "Inferior minor version");
	ok(otrl_api_version = expected, "Api number unchanged");

	otrl_api_version = 0;
	ok(otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB) == gcry_error(GPG_ERR_NO_ERROR),
			"Exact version");
	ok(otrl_api_version == (
				(OTRL_VERSION_MAJOR << 16) |
				(OTRL_VERSION_MINOR << 8) |
				(OTRL_VERSION_SUB)
				), "Api version set for exact version");
}
Beispiel #2
0
OtrPluginObject::OtrPluginObject(QObject *parent) : QObject{parent}
{
    m_otrAvailable = otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB) == 0;
}