diff --git a/src/mol-script/transpilers/_spec/pymol.spec.ts~ b/src/mol-script/transpilers/_spec/pymol.spec.ts~ deleted file mode 100644 index aa7a812eb2a0e4a964f82e61b26e2f289c86230d..0000000000000000000000000000000000000000 --- a/src/mol-script/transpilers/_spec/pymol.spec.ts~ +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com> - */ - -import * as u from './utils'; -import { parse } from '../../transpile'; -//import { transpiler } from '../pymol/parser'; -import { keywords } from '../pymol/keywords'; -import { properties } from '../pymol/properties'; -import { operators } from '../pymol/operators'; - -/* FAULTY IMPORTS */ -import compile from '../../compiler'; - -const general = { - supported: [ - // macros - '10/cb', - 'a/10-12/ca', - 'lig/b/6+8/c+o', - - // trimming - ' name CA ', - 'name CA ', - ' name CA', - ], - unsupported: [ - // macros - 'pept/enz/c/3/n', - 'pept/enz///n', - - '/pept/lig/', - '/pept/lig/a', - '/pept/lig/a/10', - '/pept/lig/a/10/ca', - '/pept//a/10', - - // object - 'foobar', - 'protein and bazbar', - ] -}; - -describe('pymol general', () => { - general.supported.forEach(str => { - it(str, () => { - const expr = parse("pymol",str); - compile(expr); - }); - }); - general.unsupported.forEach(str => { - it(str, () => { - const transpileStr = () => parse("pymol",str); - expect(transpileStr).toThrow(); - expect(transpileStr).not.toThrowError(RangeError); - }); - }); -}); - -// check against builder output -// 'not (resi 42 or chain A)' -// '!resi 42 or chain A' -// 'b >= 0.3', -// 'b != 0.3', -// 'b>0.3', -// 'b <0.3', -// 'b <= 0.3', -// 'b = 1', -// 'fc.=.1', - -describe('pymol keywords', () => u.testKeywords(keywords, "pymol")); -describe('pymol operators', () => u.testOperators(operators, "pymol")); -describe('pymol properties', () => u.testProperties(properties, "pymol")); diff --git a/src/mol-script/transpilers/_spec/utils.ts~ b/src/mol-script/transpilers/_spec/utils.ts~ deleted file mode 100644 index 056d8b53640478c4e2dae0dcae2a214fbcaa19cb..0000000000000000000000000000000000000000 --- a/src/mol-script/transpilers/_spec/utils.ts~ +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - * @author Panagiotis Tourlas <panangiot_tourlov@hotmail.com> - */ - -import { parse } from '../../transpile'; -import { KeywordDict, PropertyDict, OperatorList } from '../types'; - -/* FAULTY IMPORTS */ -//import compile from '../../compiler'; - -export function testKeywords(keywords: KeywordDict,language: string) { - for (const name in keywords) { - it(name, () => { - const k = keywords[name]; - if (k.map) { - const expr = parse(language,name); - // compile(expr); - expect(expr).toEqual(k.map()); - } else { - const transpile = () => parse(language,name); - expect(transpile).toThrow(); - expect(transpile).not.toThrowError(RangeError); - } - }); - } -} - -export function testProperties(properties: PropertyDict, language : string) { - for (const name in properties) { - const p = properties[name]; - p['@examples'].forEach(example => { - it(name, () => { - if (!p.isUnsupported) { - const expr = parse(language,example); - expect(expr).toThrow(); -// compile(expr); - } else { - const transpile = () => parse(language,example); - expect(transpile).toThrow(); - expect(transpile).not.toThrowError(RangeError); - } - }); - }); - it(name, () => { - if (!p['@examples'].length) { - throw Error(`'${name}' property has no example(s)`); - } - }); - } -} - -export function testOperators(operators: OperatorList,language: string) { - operators.forEach(o => { - o['@examples'].forEach(example => { - it(o.name, () => { - if (!o.isUnsupported) { - const expr = parse(language,example); - expect(expr).toThrow(); - } else { - const transpile = () => parse(language,example); - expect(transpile).toThrow(); - expect(transpile).not.toThrowError(RangeError); - } - }); - }); - it(o.name, () => { - if (!o['@examples'].length) { - throw Error(`'${o.name}' operator has no example(s)`); - } - }); - }); -} diff --git a/src/mol-script/transpilers/_spec/vmd.spec.ts~ b/src/mol-script/transpilers/_spec/vmd.spec.ts~ deleted file mode 100644 index 30e46e2a4e0437eba88955d9e09528fbdb54e839..0000000000000000000000000000000000000000 --- a/src/mol-script/transpilers/_spec/vmd.spec.ts~ +++ /dev/null @@ -1,64 +0,0 @@ - -/** - * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com> - */ - -import * as u from './utils'; -//import { transpiler } from '../vmd/parser'; -import { parse } from '../../transpile'; -import { keywords } from '../vmd/keywords'; -import { properties } from '../vmd/properties'; -import { operators } from '../vmd/operators'; - -/* FAULTY IMPORTS */ -import compile from '../../compiler'; - -const general = { - supported: [ - // trimming - ' name CA ', - 'name CA ', - ' name CA', - ], - unsupported: [ - // variables - 'name $atomname', - 'protein and @myselection', - - // values outside of comparisons - 'foobar', - '34', - 'name', - 'abs(-42)', - 'abs(21+21)', - 'sqr(3)', - 'sqr(x)', - 'sqr(x+33)', - 'protein or foobar', - '34 and protein', - 'name or protein', - ] -}; - -describe('vmd general', () => { - general.supported.forEach(str => { - it(str, () => { - const expr = parse("vmd",str); - compile(expr); - }); - }); - general.unsupported.forEach(str => { - it(str, () => { - const transpileStr = () => parse("vmd",str); - expect(transpileStr).toThrow(); - expect(transpileStr).not.toThrowError(RangeError); - }); - }); -}); - -describe('vmd keywords', () => u.testKeywords(keywords, "vmd")); -describe('vmd operators', () => u.testOperators(operators, "vmd")); -describe('vmd properties', () => u.testProperties(properties, "vmd"));