AlloyTools / org.alloytools.alloy

Alloy is a language for describing structures and a tool for exploring them. It has been used in a wide range of applications from finding holes in security mechanisms to designing telephone switching networks. This repository contains the code for the tool.
Other
709 stars 124 forks source link

Fix solutions iterator #66

Closed lynaghk closed 6 years ago

lynaghk commented 6 years ago

Hi @pkriens, this pull request follows up on our email conversation. There are two commits/changes:

  1. Add a test to ensure that instances returned from the solutions iterator are not coupled to the iterator state (as they accidentally were before a39b993). I'm not sure if there's an idiomatic way to compare tuple sets by value, so the test compares the toString representations --- would love feedback on this if there's a proper way to do it w/ the existing methods.

  2. Fix the solutions iterator to return the correct number of solutions (that is, match the Alloy GUI).

This is also my first pull request, so a few other notes in case I'm doing something wrong:

lynaghk commented 6 years ago

@pkriens It seems like you rebased some commits on this branch after I forked and opened this pull request. I'll rebase my own commits on top of your latest so the diff is clearer.

Edit: On second thought, it looks like as part of your rebase you wrote similar tests (e.g., https://github.com/AlloyTools/org.alloytools.alloy/commit/8a6c478bcba99e81918f25cafe0b5a6ba725c58b#diff-87e1d06259458ba3f6ce21237bf06c3dR53) as my commits.

I'll wait to hear back from you, @pkriens, before cherry picking my commits or otherwise changing anything. Please let me know how you'd like me to proceed on this.

pkriens commented 6 years ago

The problem is fixed in the pkriens/api branch because I wanted to do this slightly different, but this PR clearly helped. Thanks.