forked from cr-marcstevens/dblpbibtex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·85 lines (75 loc) · 3.1 KB
/
test.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
rm -rf tmp &>/dev/null
mkdir tmp
cd tmp
function cleanup
{
rm *.bib *.tex *.aux &>/dev/null
}
function make_tex_doc
{
echo "\documentclass{article}" > test.tex
echo "\usepackage{url}" >> test.tex
echo "\begin{document}" >> test.tex
while [ "$1" != "" ]; do
echo "\cite{$1}" >> test.tex
shift 1
done
echo "\bibliographystyle{plain}" >> test.tex
echo "\bibliography{test}" >> test.tex
echo "\end{document}" >> test.tex
}
function test_bib_download
{
cleanup
make_tex_doc $*
touch test.bib
pdflatex test &> pdflatex1.log
../dblpbibtex test &>> dblpbibtex.log
#echo "=== test.tex ==="
#cat test.tex
#echo "================"
#echo "=== test.bib ==="
#cat test.bib
#echo "================"
pdflatex test &> pdflatex2.log
../dblpbibtex test &>> dblpbibtex.log
echo "=== test.tex ==="
cat test.tex
echo "================"
echo "=== test.bib ==="
cat test.bib
echo "================"
}
rm test.log &>/dev/null
test_bib_download "cryptoeprint:2017:190"
if [ `grep "The first collision for full SHA-1" test.bib | wc -l` -ne 1 ]; then echo "! Failed !"; exit 1; fi
test_bib_download "DBLP:conf/crypto/StevensBKAM17"
if [ `grep "Lecture Notes in Computer Science" test.bib | wc -l` -ne 1 ]; then echo "! Failed !"; exit 1; fi
test_bib_download "dblpbibtex:enablesearch" "search-cryptoeprint:stevens+karpman"
if [ `grep "Report 2015" test.bib | wc -l` -ne 2 ]; then echo "! Failed !"; exit 1; fi
test_bib_download "DBLP:conf/icfp/HamanaF11"
if [ `grep "SIGPLAN" test.bib | wc -l` -ne 1 ]; then echo "! Failed !"; exit 1; fi
#Tests on .md file input
function test_md_download
{
touch dblpbibtex.bib
echo "mainbibfile=dblpbibtex.bib" > dblpbibtex.cfg
cat > test.md<< EOF
PBFT{% cite DBLP:conf/osdi/CastroL99 %} is a consensus algorithm.
User-defined citation keys (those that do not start with "DBLP:" or "cryptoeprint:") like {% cite mythesis %} should not be parsed by dblpbibtex.
According to the [documentation](https://github.com/inukshuk/jekyll-scholar) you can pass
additional parameters like this {% cite ruby --locator 23-5 %}.
These should not be included in the dblpbibtex query. Let's see: {% cite DBLP:journals/ledger/TascaT19 --locator 23-5 %}.
DBLP Bibtex can download multiple citation keys {% cite DBLP:conf/crypto/StevensBKAM17 ruby cryptoeprint:2017:190%} as long as they are not user-defined.
The whole citation must appear in a single line. This works {% cite cryptoeprint:2017:190 %}. But not this {% cite
cryptoeprint:2018:190 %}.
These should case no error: {% cite %}, {% %}, {%%}, {%cite cryptoeprint:2017:190%}, {%cryptoeprint:2017:190%}.
EOF
../dblpbibtex test.md >> mdtest.log
}
test_md_download
if [ `grep "DBLP:conf/osdi/CastroL99" dblpbibtex.bib | wc -l` -ne 1 ]; then echo "! Failed DBLP:conf/osdi/CastroL99!"; exit 1; fi
if [ `grep "DBLP:journals/ledger/TascaT19" dblpbibtex.bib | wc -l` -ne 1 ]; then echo "! Failed DBLP:journals/ledger/TascaT19!"; exit 1; fi
if [ `grep "cryptoeprint:2017:190" dblpbibtex.bib | wc -l` -ne 1 ]; then echo "! Failed cryptoeprint:2017:190!"; exit 1; fi
if [ `grep "DBLP:conf/crypto/StevensBKAM17" dblpbibtex.bib | wc -l` -ne 1 ]; then echo "! Failed DBLP:conf/crypto/StevensBKAM17!"; exit 1; fi