tuura / plato

A DSL for asynchronous circuits specification
Other
12 stars 2 forks source link

WIP: Added tests for translation. #54

Closed jrbeaumont closed 7 years ago

jrbeaumont commented 7 years ago

@snowleopard: I have added some tests, but found some issues along the way.

In order to do the testing, the translation code needs to be installed as part of the cabal build phase, therefore I have refactored some of it into Tuura.Concept.STG.Translation. This allows testing to occur on .g output and arcs of different concepts.

First of all, if you think these tests need some changes, please let me know.

Second of all: I have attempted to change the translate/Main.hs file, so it uses as much of the Tuura.Concept.STG.Translation as possible. However, testing this produces a seg. fault, and debugging proves it is because Signal is defined in the Translation module, not in the Main.hs file.

I have had a go at hiding Signal when importing Tuura.Concept.STG.Translation, and redefining it in translate/Main.hs, but this provides incompatability issues when attempting to retrieve information on the CircuitConcept itself.

Thus, there is now a lot of repeated code, and changing the actual translation code used from translate/Main.hs means that the TransTest.hs file won't actually correctly test the translation process.

Do you have any ideas for this?

jrbeaumont commented 7 years ago

@snowleopard I have made the changes to the test file.

With regards to using a type variable, [a]. Most of it requires it to be Signal, as it needs to get information from the Concept. Are you sure we can use [a] instead?

snowleopard commented 7 years ago

@jrbeaumont Let's look at function doTranslate for example. Can't it have the following type instead?

doTranslate :: (Show a, Ord a) => [a] -> Concept (State a) (Transition a) a -> String

As far as I can see, all we need is to show and compare signals?

jrbeaumont commented 7 years ago

@snowleopard: OK I just found that as you posted it haha. Changed some things around, seems to work fine. Just going to test it now.

jrbeaumont commented 7 years ago

@snowleopard: I have changed the code as needed, and tested it both alone, and in Workcraft, all appears to be working well.

jrbeaumont commented 7 years ago

Cleared those up, still working well :) Let me know if you have more suggestions!

snowleopard commented 7 years ago

@jrbeaumont Great, merged now!

jrbeaumont commented 7 years ago

@snowleopard: Thanks!