-
Notifications
You must be signed in to change notification settings - Fork 3
/
gen_tests.py
58 lines (42 loc) · 1.24 KB
/
gen_tests.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/env python3
from string import Template
test_template_bibtex = r"""\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{url}
\usepackage{amscd,amsmath}
\usepackage{amsfonts}
\usepackage[cm]{fullpage}
\begin{document}
\nocite{*}
\bibliographystyle{alpha}
\bibliography{../db/abbrev${short},../db/crypto${crossref}}
\end{document}
"""
test_template_biber = r"""\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{url}
\usepackage{amscd,amsmath}
\usepackage{amsfonts}
\usepackage[cm]{fullpage}
\usepackage{biblatex}
\bibliography{../db/abbrev${short},../db/crypto${crossref}}
\begin{document}
\nocite{*}
\printbibliography{}
\end{document}
"""
test_templates = {
"bibtex": test_template_bibtex,
"biber": test_template_biber,
}
def main():
for bib_software in ["bibtex", "biber"]:
for crossref in ["", "_crossref"]:
for short in range(4):
with open("test_abbrev{}{}_{}.tex".format(short, crossref, bib_software), "w") as out:
out.write(
Template(test_templates[bib_software])
.substitute(short=short, crossref=crossref))
if __name__ == "__main__":
main()