Add ".plt" to Prolog extensions (#6141)
* Create plunit_test_example.plt * Add ".plt" to Prolog extensions in languages.yml * Copy Gnuplot sample defense_plotter.p to defense_plotter.plt * Add heuristic for Prolog .plt files Per suggestion: https://github.com/github/linguist/pull/6141#issuecomment-1312517712 * Update test_heuristics.rb * Fix test_heuristics.rb --------- Co-authored-by: Colin Seymour <colin@github.com>
This commit is contained in:
Родитель
c1c34e5260
Коммит
3eb115da53
|
@ -506,6 +506,10 @@ disambiguations:
|
|||
- language: XML Property List
|
||||
pattern: '^\s*(?:<\?xml\s|<!DOCTYPE\s+plist|<plist(?:\s+version\s*=\s*(["''])\d+(?:\.\d+)?\1)?\s*>\s*$)'
|
||||
- language: OpenStep Property List
|
||||
- extensions: ['.plt']
|
||||
rules:
|
||||
- language: Prolog
|
||||
pattern: '^\s*:-'
|
||||
- extensions: ['.pm']
|
||||
rules:
|
||||
- language: Perl
|
||||
|
|
|
@ -5163,6 +5163,7 @@ Prolog:
|
|||
color: "#74283c"
|
||||
extensions:
|
||||
- ".pl"
|
||||
- ".plt"
|
||||
- ".pro"
|
||||
- ".prolog"
|
||||
- ".yap"
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# defense_plotter.plt
|
||||
#
|
||||
# This is a gnuplot script that creates the graphs for defense values.
|
||||
#
|
||||
# Defense values are from:
|
||||
#
|
||||
# http://wiki.starsautohost.org/wiki/Guts_of_bombing
|
||||
# Author: Leonard Dickens
|
||||
# Date: 1998/07/17
|
||||
# Forums: rec.games.computer.stars
|
||||
#
|
||||
# :author: Brandon Arrendondo
|
||||
# :license: MIT
|
||||
#
|
||||
set terminal pngcairo transparent truecolor font "Arial Bold,10" size 350, 250
|
||||
set output "out.png"
|
||||
|
||||
set title "Shield Coverage vs. Defense Quantity"
|
||||
set grid
|
||||
set xrange [0:100]
|
||||
set xlabel "Number of Defenses"
|
||||
|
||||
set format y '%2.0f%%'
|
||||
set yrange [0:100]
|
||||
|
||||
set key right bottom
|
||||
|
||||
sdi = 0.0099
|
||||
missile_battery = 0.0199
|
||||
laser_battery = 0.0239
|
||||
planetary_shield = 0.0299
|
||||
neutron_shield = 0.0379
|
||||
|
||||
val = neutron_shield
|
||||
|
||||
f(x) = (1.0 - ((1.0 - (val)) ** x)) * 100.0
|
||||
g(x) = (1.0 - ((1.0 - (val/2.0)) ** x)) * 100.0
|
||||
|
||||
plot f(x) title "Standard" lt rgb "#000080", g(x) title "Smart" lt rgb "#000000"
|
|
@ -0,0 +1,11 @@
|
|||
:- use_module(library(plunit)).
|
||||
|
||||
:- begin_tests(plunit_test_example).
|
||||
|
||||
test(true_succeeds) :-
|
||||
true.
|
||||
|
||||
test(fail_fails, [fail]) :-
|
||||
fail. % Interchangeable with false/0.
|
||||
|
||||
:- end_tests(plunit_test_example).
|
|
@ -734,6 +734,14 @@ class TestHeuristics < Minitest::Test
|
|||
})
|
||||
end
|
||||
|
||||
def test_plt_by_heuristics
|
||||
assert_heuristics({
|
||||
"Prolog" => all_fixtures("Prolog", "*.plt"),
|
||||
# Gnuplot lacks a heuristic
|
||||
nil => all_fixtures("Gnuplot", "*.plt")
|
||||
})
|
||||
end
|
||||
|
||||
def test_pm_by_heuristics
|
||||
assert_heuristics({
|
||||
"Perl" => all_fixtures("Perl", "*.pm"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче