Equivalence Partition [closed] - unit-testing

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
If the temperature falls below 18 degrees, the heating is switched on.when the temperature reaches 21 degrees, the heating is switched off.what are the boundries solution for this problem?
How to solve this problem?

Equivalence partitioning is a testing technique. The idea is to divide the input data into equivalent ("similar") classes and have a test case covering each partition at least one time. This technique is used to reduce the amount of test cases.
In this given example, there are 2 main points where the state changes. So the line segments in between will represent the equivalent classes.
Class 1: less than 18 (the heating should be on)
Class 2: from 18 to 21
Class 3: greater than 21 (the heating should be off)
So the minimum set of input test values to cover all valid equivalence partitions would be one value from each of those classes. Let's say: 16, 20, 25

Any one from min limit-18-20-21-Anyone from Max limit...

The minimum is 3 values:2 outside the boundaries a<18, b>21 and one inside the range
http://istqbexamcertification.com/what-is-equivalence-partitioning-in-software-testing/

If the temperature falls below 18 degrees, the heating is switched on.when the temperature reaches 21 degrees, the heating is switched off.what is the minimum set of test input values to cover all valid equivalence partitions?
Ans:-
Your temperature is 12,15,17 is heating.
your Temperature is 21,23,26 is no heating.
answer is 16,21,24.

Related

Uniswap V3 sqrtPrice for ETH/DAI and ETH/USDT, ETH/USDC vastly different [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 months ago.
Improve this question
I use IUniswapV3PoolState.slot0 to return sqrtPriceX96 and tick for different pairs in Uniswap V3. The results are very reasonable for ETH/DAI, but it's quite different for ETH/USDT and ETH/USDC.
This is not because of the order of the tokens, but rather the final result of price (after taking care of square root and Q96) differ by 10^(-12). So I would get ETH/DAI around $3200, while ETH/USDT and ETH/USDC will give $3200*10^(-12). Is there anything I'm missing? Thank you!
EVM compatible blockchains use fixed-point math. The floating point values that you see in the UI are abstractions, technically everything is an integer; a specific number of digits reserved to represent the decimals. Different ERC-20 tokens reserve a different number of decimals.
WETH and DAI have 18 decimals
USDT and USDC have 6 decimals.
If you have asset X that has 6 and an asset Y that has 18 decimals, then the price of Y in terms of X has to be corrected for this fact.
Lets use price = y/x, then the price adjusted for the amount of decimals is going to be price_adjusted = y/x * 10^(-12). To see why refer to Section 3.3.2 here:

Detect extreme value vector C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a vector of values (delays) like this {2,4,6,3,4,5,6,4,..} in C++. My objective is to detect when a new value is an extreme value - for example, 96. I am trying to come up with a general check to detect instead of putting specific numerical checks.
By extreme value I mean 96 would be X times larger than 2 or 3 or 4. However, if I have delays as {15,23,10,26,..} and then a value 550, which is Y times larger than normal - I want to detect.
I need to start with the standard deviation, but not sure about the best approach further.
Thank you.
In the absence of any other statistical information, compute the mean and the standard deviation of the mean of your existing data, and if the new point is more than 3 standard deviations of the mean outside that mean, then don't add it.
After you have a certain number of points so you can be reasonably sure that the central limit theorem has started to work its magic (20 points as a rule of thumb, especially as "delays" implies "Poisson" on first glance), develop an algorithm to eliminate any outliers that might have been added to the initial set. Do that by considering each added point in turn - eliminate it, and see it matches the criteria for inclusion. This step is important: it's designed to fail an outlier that's introduced early; e.g. {2, 96, 4, 6, 3, 4, 5}. For really hostile data you might need to increase the dimensionality of that algorithm.
This is a tricky science - you'll have to calibrate this to suit your requirements but what I suggest will get you started.

Changing an int value into time using casting and setfill [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
For a programming assignment, I need to display the time a hypothetical cafe is open. On the weekends the cafe opens an hour and a half later than during the week, but closes at the same time.
The user inputs the opening time, closing time, and how much later it opens on the weekend. The program is supposed to calculate and display the schedule for the cafe. So far my program can do all of this, but I just don't know how to convert a regular integer, such as 845, into the time format, such as 8:45.
My teacher suggesting using casting and setfill. I have tried researching both but I'm just not sure where it applies in the program.
So, how can I convert an integer (e.g. 845) into the time format (e.g. 8:45)?
I guess we can assume that the integer number is always between 0 and 2400, so we're interested in four of it's digits, at most.
One way is to access parts of the integer by division and modulo. Let's take 1245 (12:45) as an example:
1245 / 100 = 12 (always rounded down)
1245 % 100 = 45 (<= modulo operator)
So by using division and modulo, we can extract the first two numbers (= hours) and second two numbers (= minutes) separately.
The rest is easy:
int time = 1245; //your time
int hours = time / 100;
int minutes = time % 100;
//print it
std::cout << hours << ":" << minutes << std::endl;
Result: 12:45

SPOJ : BANKROB STATEMENT NOT CLEAR [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have recently started practicing graph theory problems.
I recently encountered this problem : BANKROB
Even after having gone through the problem statement several times, I am unable to understand how the given output for the sample cases has been computed.
I will be grateful to you, if you can please explain the sample test cases.
I'll explain one.
The first line says the city has ten crossroads (nodes) and 14 roads (edges). This helps you set up the problem, but it's not really necessary because you can tell that from the remainder of the input.
The second line says the robbers' goal is to get from node 1 to node ten. (your goal is to stop them).
The third through 16th lines each represent one road (edge.) Note that there are 14 edges and ten nodes as predicted by line 1. This information lets you create a graph.
To capture the robbers you need block (delete) the fewest possible nodes to separate node one from node ten. As it turns out in this case deleting node five and six will do the trick, so the answer to the question is 2, the number of crossroads you need to delete.
Now how to compute this? Well that's what you are studying, right?
To understand the solutions, it helps to visualize the data that's depicted. (Of course, you'll have the computer program do this entirely differently.) Based on the input, the roads basically look like this:
2 - 5 - 7
/ / \ \
1 - 3 - 6 - 8 - 10
\ / \ /
4 9
To cut off all paths from 1-10, just remove the choke points at 5 and 6.
However, to cut off from 5-10 (assuming all the roads are bidirectional), you can't just remove 7 and 8 - the robbers can backtrack from 5-3-6-9-10. So you have to cut off 7, 8 and 9.
Thus, for the first example, there are 2 places to cut off, but in the second, there are 3.

finding if a number is a common multiples of some other numbers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I want to write a program that calculates if a number is a multiple of some other numbers.
Lets say that i want to check if 25 can be given from a function like 2a+3b+4c=25.Is there any algorithm that can find a b c in order to check if abc are integers?
For generating all possibilities, a Brute force algorithm will suffice:
Loop over all possible values for a and subtract the sum 2a from 25. Nest similar loops for b using the remainder. If the remainder after subtracting 3b is a multiple of 4, then loop over all possible values of c and output a, b, and c as a combination.