{"action":"created","issue":{"url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/7","labels_url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/7/comments","events_url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/7/events","html_url":"https://github.com/grogers0/CppQuickCheck/issues/7","id":64234320,"number":7,"title":"How to write test for floating-point properties to avoid infinite loop?","user":{"login":"rpietruc","id":6428245,"avatar_url":"https://avatars.githubusercontent.com/u/6428245?v=3","gravatar_id":"","url":"https://api.github.com/users/rpietruc","html_url":"https://github.com/rpietruc","followers_url":"https://api.github.com/users/rpietruc/followers","following_url":"https://api.github.com/users/rpietruc/following{/other_user}","gists_url":"https://api.github.com/users/rpietruc/gists{/gist_id}","starred_url":"https://api.github.com/users/rpietruc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpietruc/subscriptions","organizations_url":"https://api.github.com/users/rpietruc/orgs","repos_url":"https://api.github.com/users/rpietruc/repos","events_url":"https://api.github.com/users/rpietruc/events{/privacy}","received_events_url":"https://api.github.com/users/rpietruc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-25T10:11:23Z","updated_at":"2015-03-28T03:02:21Z","closed_at":null,"body":"If I write following test:\r\nstruct PropertyInfiniteLoop : cppqc::Property<float> {\r\n    bool check(const float &a) const override { return (a > 0); }\r\n};\r\nand call:\r\ncppqc::quickCheckOutput(PropertyInfiniteLoop());\r\nIt will enter an infinite loop.\r\nIs it expected behavior?\r\nHow can I avoid this issue properly?\r\n"},"comment":{"url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/comments/87152984","html_url":"https://github.com/grogers0/CppQuickCheck/issues/7#issuecomment-87152984","issue_url":"https://api.github.com/repos/grogers0/CppQuickCheck/issues/7","id":87152984,"user":{"login":"grogers0","id":71939,"avatar_url":"https://avatars.githubusercontent.com/u/71939?v=3","gravatar_id":"","url":"https://api.github.com/users/grogers0","html_url":"https://github.com/grogers0","followers_url":"https://api.github.com/users/grogers0/followers","following_url":"https://api.github.com/users/grogers0/following{/other_user}","gists_url":"https://api.github.com/users/grogers0/gists{/gist_id}","starred_url":"https://api.github.com/users/grogers0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grogers0/subscriptions","organizations_url":"https://api.github.com/users/grogers0/orgs","repos_url":"https://api.github.com/users/grogers0/repos","events_url":"https://api.github.com/users/grogers0/events{/privacy}","received_events_url":"https://api.github.com/users/grogers0/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T03:02:21Z","updated_at":"2015-03-28T03:02:21Z","body":"Seems like it is stuck trying to shrink the test case but generating too many cases. My guess is that it does iteratively improve the shrink each time (it moves towards 0), but because there are a LOT of floating point values between a reasonable first guess and 0, it never actually finishes shrinking.\r\n\r\nMaybe a good workaround here is to stop after a certain number of tries."}}