Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Tests
  • Loading branch information
rcosta358 committed Mar 28, 2026
commit a60da241bfda76269f0f9ea460ff09806dd63077

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testSuite.classes.downloader_correct;

import liquidjava.specification.Ghost;
import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;

@Ghost("int progress")
@StateSet({"created", "downloading", "completed"})
public class Downloader {

@StateRefinement(to="created(this) && progress(this) == 0")
public Downloader() {}

@StateRefinement(from="created(this) && progress(this) == 0", to="downloading(this) && progress(this) == 0")
public void start() {}

@StateRefinement(from="downloading(this)", to="downloading(this) && progress(this) == percentage")
public void update(@Refinement("percentage > progress(this)") int percentage) {}

@StateRefinement(from="downloading(this) && progress(this) == 100", to="completed(this)")
public void finish() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package testSuite.classes.downloader_correct;

public class SimpleTest {
public static void main(String[] args) {
Downloader d = new Downloader();
d.start();
d.update(50);
d.update(100);
d.finish();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refinement Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testSuite.classes.downloader_refinement_error;

import liquidjava.specification.Ghost;
import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;

@Ghost("int progress")
@StateSet({"created", "downloading", "completed"})
public class Downloader {

@StateRefinement(to="created(this) && progress(this) == 0")
public Downloader() {}

@StateRefinement(from="created(this) && progress(this) == 0", to="downloading(this) && progress(this) == 0")
public void start() {}

@StateRefinement(from="downloading(this)", to="downloading(this) && progress(this) == percentage")
public void update(@Refinement("percentage > progress(this)") int percentage) {}

@StateRefinement(from="downloading(this) && progress(this) == 100", to="completed(this)")
public void finish() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package testSuite.classes.downloader_refinement_error;

public class SimpleTest {
public static void main(String[] args) {
Downloader d = new Downloader();
d.start();
d.update(50);
d.update(40); // Refinement Error
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
State Refinement Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testSuite.classes.downloader_state_refinement_error;

import liquidjava.specification.Ghost;
import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;

@Ghost("int progress")
@StateSet({"created", "downloading", "completed"})
public class Downloader {

@StateRefinement(to="created(this) && progress(this) == 0")
public Downloader() {}

@StateRefinement(from="created(this) && progress(this) == 0", to="downloading(this) && progress(this) == 0")
public void start() {}

@StateRefinement(from="downloading(this)", to="downloading(this) && progress(this) == percentage")
public void update(@Refinement("percentage > progress(this)") int percentage) {}

@StateRefinement(from="downloading(this) && progress(this) == 100", to="completed(this)")
public void finish() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package testSuite.classes.downloader_state_refinement_error;

public class SimpleTest {
public static void main(String[] args) {
Downloader d = new Downloader();
d.start();
d.update(50);
d.finish(); // State Refinement Error
}
}
Loading