* Different test cases - more the better to adequately test the target function for all
* requirements per the question.
* Number of test cases depends on question and number & type of parameters in target.
* Target should be to have 0 errors. Print the number of test cases and error count as done here
* In final submisison comment out debugging System.out.println statements only keep the same ones as in this sample - one in test helper and two in test cases
*/
private void icyHotTestCases() {
System.out.println("IcyHot test cases run at " + new java.util.Date() );
testIcyHot(0, 0, false);
testIcyHot(0, 101, false);
testIcyHot(-1, 101, true);
testIcyHot(500, -101, true);
testIcyHot(0, 101, false);
testIcyHot(-100, 1999, true);
System.out.println("Icy Hot test cases count " + count + ", Errors :" + errs + ".");
/*
Given a string, return true if the number of appearances of "that" anywhere in the string is equal to the number of
appearances of "this" anywhere in the string (case in-sensitive).
sameThatThis("That That This") -> false
sameThatThis("This is not That") -> true
sameThatThis("thisnoisthatxxnotbthatyynotxisi that this forthis") -> true
*/
public boolean sameThatThis(String str) {
//your target function, don't change signature, add to a new class file
}
// IMPORTANT : Follow TDD test driven development
//first do the test helper and write at least 6 different test cases and last implement your target function
}
/*
Add main method ->
testCases (think of edge test cases besides the 3 I have given) ->
test Helper functions, then implement above target function all same class , as in IcyHot
Unit test with tests and test helper in same class. Follow same pattern and order.
*/
/*
First add test cases, then test helper and last try to solve the target function (and its helper)
Copy this to a new Class with appropriate name.
Can copy parts of IcyHot to new class or type everything.
Create a new class, sample and instructions: (IcyHot)
So you will have a new class with 5 methods (including the helper). Please make sure icyHot comments or function names are not there, rename everything to match this question.
Don't use regex. Do use loops and your own logic.
*/
Has test cases, that is in one method that repeatedly calls a test helper
Go thru the test helper, see how its constructed from the target method - the relationship of parameters in the test helper vs the parameters in the target method.
The comments try to explain them. Please read the comments two times slowly.
Comments
Tushar
Mon, 10/31/2022 - 14:12
Permalink
sample
github.com/tgkprog/academic/blob/main/IcyHot.java
Tushar
Mon, 10/31/2022 - 14:32
Permalink
https://docs.google.com
https://docs.google.com/document/d/e/2PACX-1vRS7wtXUTmD0AbKJymoC66wQ3o2b...
Tushar
Mon, 10/31/2022 - 15:09
Permalink
Jobs
https://docs.google.com/presentation/d/16shrhpB3NBMqjBCPOfuKuOjRYGE6bptB...
Tushar
Mon, 10/31/2022 - 15:35
Permalink
Db
https://docs.google.com/spreadsheets/d/1udht63yVyExrPthaHYWvfYGrLQO0NI3V...
Tushar
Wed, 11/16/2022 - 16:55
Permalink
https://docs.google.com
https://docs.google.com/document/d/1JBmjJ56gLMIGVH8r4irE6Z3Gz9zSJmryhWUh...
https://leetcode.com/problemset/?difficulty=MEDIUM&page=1&topicSlugs=string
https://www.hackerrank.com/domains/algorithms?filters%5Bsubdomains%5D%5B...
Tushar
Thu, 02/29/2024 - 12:13
Permalink
count of "that" "this"
/*
Given a string, return true if the number of appearances of "that" anywhere in the string is equal to the number of
appearances of "this" anywhere in the string (case in-sensitive).
sameThatThis("That That This") -> false
sameThatThis("This is not That") -> true
sameThatThis("thisnoisthatxxnotbthatyynotxisi that this forthis") -> true
*/
public boolean sameThatThis(String str) {
//your target function, don't change signature, add to a new class file
}
// IMPORTANT : Follow TDD test driven development
//first do the test helper and write at least 6 different test cases and last implement your target function
}
/*
Add main method ->
testCases (think of edge test cases besides the 3 I have given) ->
test Helper functions, then implement above target function all same class , as in IcyHot
Unit test with tests and test helper in same class. Follow same pattern and order.
*/
/*
First add test cases, then test helper and last try to solve the target function (and its helper)
Copy this to a new Class with appropriate name.
Can copy parts of IcyHot to new class or type everything.
Create a new class, sample and instructions: (IcyHot)
So you will have a new class with 5 methods (including the helper). Please make sure icyHot comments or function names are not there, rename everything to match this question.
Don't use regex. Do use loops and your own logic.
*/
Tushar
Mon, 07/08/2024 - 16:44
Permalink
About
https://sel2in.com/news/code/icyHot
is a sample code of a core java problem solving
i have solved it partly
you dont need to solve it
We have a target method, but we solve this last.
Has test cases, that is in one method that repeatedly calls a test helper
Go thru the test helper, see how its constructed from the target method - the relationship of parameters in the test helper vs the parameters in the target method.
The comments try to explain them. Please read the comments two times slowly.