Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The spartianizer changed my code and caused tests to fail #1618

Open
noamyft opened this issue Jul 3, 2017 · 1 comment
Open

The spartianizer changed my code and caused tests to fail #1618

noamyft opened this issue Jul 3, 2017 · 1 comment
Assignees

Comments

@noamyft
Copy link
Contributor

noamyft commented Jul 3, 2017

I just spartinzed my class. After I run the test, I discovered 2 tests failed.
When I looked into it, I discover that the spartanizer change my code:
Form this:

		return storePackages.stream().map(sp -> {
			long periodInDays = ChronoUnit.DAYS.between(currentDate, sp.getExpirationDate());
			double ratio = periodInDays == 0 ? 0 : sp.getAmount() / periodInDays;
			return new HighRatioAmountExpirationTimeProperty(ratio, sp);
		}).filter(p -> p.getRatio() >= HighRatioAmountExpirationTimeProperty.ratioThreshold)
				.collect(Collectors.toSet());

To this:


		return storePackages.stream().map(sp -> {
			long periodInDays = ChronoUnit.DAYS.between(currentDate, sp.getExpirationDate());
			double ratio = periodInDays == 0 ? 0 : periodInDays * sp.getAmount() / 1.;
			return new HighRatioAmountExpirationTimeProperty(ratio, sp);
		}).filter(p -> p.getRatio() >= HighRatioAmountExpirationTimeProperty.ratioThreshold)
				.collect(Collectors.toSet());

Meaning, this: sp.getAmount() / periodInDays changed to this: periodInDays * sp.getAmount() / 1.

From what I understand, it changed the operation from division to multiplication. If so, this is seriously bad.

@OriRoth
Copy link
Collaborator

OriRoth commented Jul 3, 2017

@ravivos why did you assigned me? I am not related to arithmetic tippers. Talk to Yossi/Niv please.

@OriRoth OriRoth assigned ravivos and unassigned OriRoth Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants