summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartino Pilia <martino.pilia@gmail.com>2018-11-11 18:26:37 +0100
committerMartino Pilia <martino.pilia@gmail.com>2018-11-11 18:26:37 +0100
commit0b4507ed565a53ad884dd9c7a0042daa4c782ae4 (patch)
treef731ba52b456cfd402423115780619a98dde23aa /test
parentd30da203b91345b472e5d83f048bd42a6ca13804 (diff)
downloadale-0b4507ed565a53ad884dd9c7a0042daa4c782ae4.zip
Add linter for ispc
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_ispc_ispc_command_callbacks.vader27
-rw-r--r--test/handler/test_ispc_ispc_handler.vader347
2 files changed, 374 insertions, 0 deletions
diff --git a/test/command_callback/test_ispc_ispc_command_callbacks.vader b/test/command_callback/test_ispc_ispc_command_callbacks.vader
new file mode 100644
index 00000000..e5a0dec2
--- /dev/null
+++ b/test/command_callback/test_ispc_ispc_command_callbacks.vader
@@ -0,0 +1,27 @@
+Before:
+ call ale#assert#SetUpLinterTest('ispc', 'ispc')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The executable should be configurable):
+ AssertLinter 'ispc',
+ \ ale#Escape('ispc')
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -'
+
+ let b:ale_ispc_ispc_executable = 'foo'
+
+ AssertLinter 'foo',
+ \ ale#Escape('foo')
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -'
+
+Execute(The options should be configurable):
+ let g:ale_ispc_ispc_options = '--foo'
+
+ AssertLinter 'ispc',
+ \ ale#Escape('ispc')
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' --foo'
+ \ . ' -'
diff --git a/test/handler/test_ispc_ispc_handler.vader b/test/handler/test_ispc_ispc_handler.vader
new file mode 100644
index 00000000..3fb67277
--- /dev/null
+++ b/test/handler/test_ispc_ispc_handler.vader
@@ -0,0 +1,347 @@
+Before:
+ runtime ale_linters/ispc/ispc.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The ispc handler should parse input correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 33,
+ \ 'col': 14,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''int'', expecting '','' or '';''.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 36,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''for''.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 40,
+ \ 'col': 24,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_re".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 40,
+ \ 'col': 29,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_re".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 40,
+ \ 'col': 36,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_im".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 40,
+ \ 'col': 41,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_im".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 41,
+ \ 'col': 30,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_re".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 41,
+ \ 'col': 37,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "z_im".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 42,
+ \ 'col': 18,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''{''.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 58,
+ \ 'col': 17,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "y1". Did you mean "i", or "or"?',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 58,
+ \ 'col': 22,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "y0". Did you mean "i", or "or"?',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 58,
+ \ 'col': 28,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "height".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 60,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''for''.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 71,
+ \ 'col': 23,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "y0". Did you mean "dy", or "i", or "or"?',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 71,
+ \ 'col': 28,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "j". Did you mean "i"?',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 73,
+ \ 'col': 25,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "j". Did you mean "i", or "y"?',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 73,
+ \ 'col': 29,
+ \ 'type': 'E',
+ \ 'text': 'Undeclared symbol "width".',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 74,
+ \ 'col': 13,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected identifier.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 51,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': '''foobar.h'' file not found',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 79,
+ \ 'col': 52,
+ \ 'type': 'W',
+ \ 'text': 'Modulus operator with varying types is very inefficient.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 85,
+ \ 'col': 13,
+ \ 'type': 'W',
+ \ 'text': 'Undefined behavior: all program instances are writing to the same location!',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 19,
+ \ 'type': 'W',
+ \ 'text': 'Gather required to load value.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 9,
+ \ 'type': 'W',
+ \ 'text': 'Scatter required to store value.',
+ \ 'filename': has('win32')
+ \ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
+ \ : '/testplugin/test/handler/mandelbrot.ispc',
+ \ },
+ \ ],
+ \ ale_linters#ispc#ispc#Handle(0, [
+ \ 'Warning: No output file or header file name specified. Program will ',
+ \ ' be compiled and warnings/errors will be issued, but no output will be ',
+ \ ' generated. ',
+ \ 'Warning: No --target specified on command-line. Using default system ',
+ \ ' target "avx2-i32x8". ',
+ \ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', ',
+ \ ' expecting '','' or '';''. ',
+ \ 'static iline int mandel(float c_re, float c_im, int count) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''. ',
+ \ ' for (i = 0; i < count; ++i) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:40:24: Error: Undeclared symbol "z_re". ',
+ \ ' float new_re = z_re*z_re - z_im*z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:40:29: Error: Undeclared symbol "z_re". ',
+ \ ' float new_re = z_re*z_re - z_im*z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:40:36: Error: Undeclared symbol "z_im". ',
+ \ ' float new_re = z_re*z_re - z_im*z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:40:41: Error: Undeclared symbol "z_im". ',
+ \ ' float new_re = z_re*z_re - z_im*z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:41:30: Error: Undeclared symbol "z_re". ',
+ \ ' float new_im = 2.f * z_re * z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:41:37: Error: Undeclared symbol "z_im". ',
+ \ ' float new_im = 2.f * z_re * z_im;',
+ \ ' ^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:42:18: Error: syntax error, unexpected ''{''. ',
+ \ ' unmasked {',
+ \ ' ^',
+ \ '',
+ \ 'mandelbrot.ispc:58:17: Error: Undeclared symbol "y1". Did you mean ',
+ \ ' "i", or "or"? ',
+ \ ' float dy = (y1 - y0) / height;',
+ \ ' ^^',
+ \ '',
+ \ 'mandelbrot.ispc:58:22: Error: Undeclared symbol "y0". Did you mean ',
+ \ ' "i", or "or"? ',
+ \ ' float dy = (y1 - y0) / height;',
+ \ ' ^^',
+ \ '',
+ \ 'mandelbrot.ispc:58:28: Error: Undeclared symbol "height". ',
+ \ ' float dy = (y1 - y0) / height;',
+ \ ' ^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:60:5: Error: syntax error, unexpected ''for''. ',
+ \ ' for (uniform int j = 0; j < height; j++) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:71:23: Error: Undeclared symbol "y0". Did you mean ',
+ \ ' "dy", or "i", or "or"? ',
+ \ ' float y = y0 + j * dy;',
+ \ ' ^^',
+ \ '',
+ \ 'mandelbrot.ispc:71:28: Error: Undeclared symbol "j". Did you mean ',
+ \ ' "i"? ',
+ \ ' float y = y0 + j * dy;',
+ \ ' ^',
+ \ '',
+ \ 'mandelbrot.ispc:73:25: Error: Undeclared symbol "j". Did you mean ',
+ \ ' "i", or "y"? ',
+ \ ' int index = j * width + i;',
+ \ ' ^',
+ \ '',
+ \ 'mandelbrot.ispc:73:29: Error: Undeclared symbol "width". ',
+ \ ' int index = j * width + i;',
+ \ ' ^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:74:13: Error: syntax error, unexpected ',
+ \ ' identifier. ',
+ \ ' output[index] = mandel(x, y, maxIterations);',
+ \ ' ^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:51:9: fatal error: ''foobar.h'' file not found',
+ \ '#include<foobar.h>',
+ \ ' ^~~~~~~~~~',
+ \ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with ',
+ \ ' varying types is very inefficient. ',
+ \ ' double x = x0 + i * (dx + epsilon*(k%2)*delta);',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program ',
+ \ ' instances are writing to the same location! ',
+ \ ' output[index] = (NNN) / sample_size;',
+ \ ' ^^^^^^^^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value. ',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value. ',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ ])