File: test_python.cc

package info (click to toggle)
cruft-ng 0.9.72
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,400 kB
  • sloc: cpp: 1,737; sh: 796; python: 245; makefile: 108; ansic: 82; perl: 75
file content (31 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include "python.h"

#define GREEN "\033[1;32m"
#define RED "\033[1;31m"
#define BLACK "\033[0m"

void test(string path, bool expected) {
	cout << "checking: " << path << endl;
	if (pyc_has_py(path, true) == expected) {
		cout << GREEN << "OK" << BLACK << endl << endl;
	} else {
		cout << RED << "ERROR" << BLACK << endl << endl;
	};
}

int main()
{
	init_python();
	cout << "installed versions:" << endl;
	for (unsigned int i=0;i<versions.size();i++) {
		cout << GREEN << versions[i] << BLACK << endl;
	}
	cout << endl;

	test("/usr/share/games/game-data-packager/game_data_packager/__pycache__", true);
	test("/usr/share/python3/debpython/__pycache__/option.cpython-310.pyc", false);
	test("/usr/share/python3/debpython/__pycache__/option.cpython-311.pyc", true);
	test("/usr/share/python3/debpython/__pycache__/option.cpython-312.pyc", true);
	test("/usr/share/python3/debpython/__pycache__/option.cpython-313.pyc", false);
}