Add FFI bindings for all API functions. Implement getCategories and getFunctions

This commit is contained in:
John J. Camilleri
2021-10-04 14:15:35 +02:00
parent 45db11b669
commit 7551926383
4 changed files with 126 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
import PGF from '../index'
// readPGF
test('readPGF successful', () => {
let gr = PGF.readPGF('../haskell/tests/basic.pgf')
})
@@ -10,7 +12,19 @@ test('readPGF missing file', () => {
}).toThrow()
})
// abstract syntax
test('abstract name', () => {
let gr = PGF.readPGF('../haskell/tests/basic.pgf')
expect(gr.getAbstractName()).toBe('basic')
})
test('categories', () => {
let gr = PGF.readPGF('../haskell/tests/basic.pgf')
expect(gr.getCategories()).toEqual(['Float','Int','N','P','S','String'])
})
test('functions', () => {
let gr = PGF.readPGF('../haskell/tests/basic.pgf')
expect(gr.getFunctions()).toEqual(['c','ind','s','z'])
})