I can't figure out this question.
A program which accepts an integer in the range -100 to +100:
1) How many valid equivalent partitions are there?
2) For which range what are minimum and maximum values?
3) Using BVA, what values need to be checked for the partitions?
So..., according to the equivalence testing, you can have a valid and invalid value. I supposed the invalid values would be anything less than -100 and greater than 100. However I can't find information about how to get equivalent partitions.
I mean, I can chose and say that it has 20 equivalent partitions, for example: -100 to -90 | -89 to 70 etc..., but: Is there a way to get this?
For the other questions: Is it possible get the previous partition so the minimum value would be -100 and the maximum -90?
Here's an example of how basic EPA & BVA applies to your data
So, practically in your case you'll have 3 values from equivalence partitioning and 4 values from boundary values analysis.
Don't forget to pay attention to 0. It's always a tricky point..
Good luck!
For Boundary value analysis, the main focus should be for the corner cases.
So for the above range, values needed to be checked for BVA are:
-101 -100 100 101 (This is as per ISTQB)
I assume that this is <-100;100> range so -100 and 100 are valid.
1) How many valid equivalent partitions are there?
Only one with any number from given range
2) For which range what are minimum and maximum values?
The minimum is -100 and the maximum is 100
3) Using BVA, what values need to be checked for the partitions?
Using BVA you have 6 values to be checked -101, - 100, -99, 99, 100 and 101 (the minumum/ the maximum and the next valid one just to find bugs in x>-100 except x>=-100, i.e. when programmer wrote x>-100 and you will check only -100 you will not find a bug, if you check also -99 you will find a bug).
1) How many valid equivalent partitions are there?
Theoretically for your range of -100 and 100 there would be three equivalent class partitions:
1) one partition having values below -100 i.e. -101,-102 etc. These are invalid values class.
2) Second partition having values between -100 and 100(including -100 and 100). These are valid values class.
3) Third partition having values greater than 100 i.e. 101,102 etc. These are invalid values class.
Now you can choose one value from each partition. For example,
1) You can choose -118 from first class(invalid class partition).
2) You can choose 70 from second class(valid class partition).
3) You can choose 170 from third class(invalid class partition).
But in my view if you want to check with more values you can do more partitions within class -100 to 100. For example you can divide it into -100 to -51, -50 to 0, 1 to 50, 51 to 100. Then you can choose one value from each of these partitions.
The main purpose of ECP is to reduce the number of test cases(test values) so if you have enough time then you can choose more than one value from each class or you can do make more classes and choose values from them.
2) For which range what are minimum and maximum values?
1) For first class minimum value cannot be described, maximum value is -101.
2) For second class minimum value is -100 and maximum value is 100.
3) For Third class minimum value is 101 and maximum value cannot be described.
3) Using BVA, what values need to be checked for the partitions?
For BVA following values need to be checked:
1) Value immediately below minimum value i.e. -101.
2) Minimum value i.e. -100.
3) Value immediately above minimum value of range i.e. -99.
4) value immediately below than maximum value of range i.e. 99.
5) Maximum value of range i.e. 100.
6) Value immediately above maximum value of range i.e. 101.
A program which accepts an integer in the range -100 to +100:
In Equivalance:
Test Scenario # Test Scenario Description Expected Outcome
Class I: values < -100 => invalid class
Class II: -100 to +100 => valid class
Class III: values > +100 => invalid class
In BVA,
1) Test cases with test data exactly as the input boundaries of input domain i.e. values -100 and +100 in our case.
2) Test data with values just below the extreme edges of input domains i.e. values -101 and +99.
3) Test data with values just above the extreme edges of input domain i.e. values -99 and +101.
Related
I can't understand why to use two values inside the boundary when using Boundary Value Analysis.
For instance, the program has the requirement: 1) Values between 1 and 100 are true, otherwise false.
func calc(x):
if (x >= 1 and x <= 100):
return True
else:
return False
A lot of books (Pressman, for instance) say you have to use the inputs 0, 1, 2, 99, 100 and 101 to test such program.
So, my question is: Why does use the inputs '2' and '99'?
I try to make a program with a fault that the test case set (0, 1, 2, 99, 100 and 101) expose a fail and the test case set (0, 1, 100, 101) does not expose it.
I can't make such program.
Could you make such program?
If not, it is a waste of resource create redundant test cases '2' and '99'.
The basic requirement is to have +-1 of the boundary values. So to test values for a range of 1-100
One test case for exact boundary values of input domains each means
1 and 100.
One test case for just below boundary value of input domains each
means 0 and 99.
One test case for just above boundary values of input domains each
means 2 and 101.
To answer your question - Why does use the inputs '2' and '99'? It is because if you are following BVA, you are checking both the limits (upper as well as lower) of the range to ensure that the software is behaving correctly. However, there are no hard and fast rules. If the range is big enough, then you should have more test points. You can also test the middle values as part of BVA.
Also, you can use Switch Case statements to create a program or multiple Ifs.
I have two values for minimum 1D and maximum 1.5D for hardware engagement. I also have table of hardware length and number.
See snapshot:
I need a formula in which it will search for minimum hardware length and respective number which is available in table (in above problem two hardware’s are within range 0.250 and 0.313, I need minimum of two). Finally, display in output cell.
This may well need some adjustment (for example what would be the result desired from .3 and .375) but hopefully gives an indication. Assumes the columns of the main table are named Size and HNum and the inputs are in A1 and B1:
Hardware size:
=INDEX(Size,IF(MATCH(A1,Size,1)+1<MATCH(B1,Size,1),MATCH(A1,Size,1)+1,MATCH(A1,Size,1)))
Hardware number:
=INDEX(HNum,IF(MATCH(A1,Size,1)+1<MATCH(B1,Size,1),MATCH(A1,Size,1)+1,MATCH(A1,Size,1)))
I have an output of ranges from 150-0. I want to map those to 0 to 1. Or perhaps 0 to (some value less than 1 such as 0.5) where 150 is 0 and 0 is 1 ( or some values less than..).
Is this considered interpolation? What is the formula to derive these values? But preferably, is there a built-in StdLib function I can call?
Divide your number by the (Max - min). This would make 150 be 1 and 0 will be 0, with everything else a number in between. Now, to make it the opposite just do 1 - result.
If you need to map 0-1 to any custom range, you need to multiply range with MAX-MIN and then add MIN to it to get the exact number in range.
Formula will be MIN + (MAX-MIN)*value
where value is range in between 0-1;
MIN is number mapped to 0;
MAX is number mapped to 1;
I have a google spreadsheet for my gaming information. It contains 2 sheets - one for monster information, another for team.
Monster information sheet contains the attack value, defend value, and the mana cost of monsters. It's almost like a database of monsters that I can summon.
Team sheet does the following:
Asks for the amount of mana I currently have.
Computes a list of up to 5 monsters that I can summon (it can be less than 5).
Each monster has their own mana cost, therefore total mana cost mustn't exceed the amount of mana I have given in point 1.
The tabulated list should give me a team that have the highest combined attack value. It does not matter how many monsters are summoned. Each monster cannot be summoned twice though.
I have been thinking of using query() function so that I can make use of SQL statements. (so that I can hopefully retrieve the tabulated list directly)
Sample: Monster Info
A B C D
1 Monster Attack Defense Cost
2 MonA 1200 1200 35
3 MonB 1400 1300 50
... ...
Sample: Team
A B C D
1 Mana 120
2
3 Attack Team
4 Monster Attack Cost Total Attack
5 MonB 1400 50 1400
6 MonA 1200 35 2600
7 ... ...
I have these formula in "Team" sheet
A5: =query('Monster Info'!$A$:$D,"SELECT A,B,D ORDER BY B DESC LIMIT 5")
B5: =CONTINUE(A5, 1, 2)
C5: =CONTINUE(A5, 1, 3)
D5: =C5
A6: =CONTINUE(A5, 2, 1)
B6: =CONTINUE(A5, 2, 2)
C6: =CONTINUE(A5, 2, 3)
D6: =D5+C6
That only gets the 5 best attack monsters, regardless of the mana cost consideration. How do I do that such that it takes consideration of both attack value and mana cost value? There is another problem shown in the example below:
Example: (simplified version, without defense value etc)
Monster Attack Cost
MonA 1400 50
MonB 1200 35
MonC 1100 30
MonD 900 25
MonE 500 20
MonF 400 15
MonG 350 10
MonH 250 5
If I have 160 mana, then the obvious team is A+B+C+D+E (5100 Attack).
If I have 150 mana, it becomes A+B+C+D+G (4950 Attack).
If I have 140 mana, it becomes A+B+C+D (4600 Attack).
If I have 130 mana, it becomes B+C+D+E+F (4100 Attack using 125 mana) or A+B+C+F (4100 Attack using all 130 mana).
If I have 120 mana, it becomes B+C+D+E+G (4050 Attack).
If I have 110 mana, it becomes B+C+D+F+H (3850 Attack).
As you can see, there isn't really a pattern within the results.
Any expert willing to share their insights on this?
I've played with the problem for an hour and I only have a workaround here. Your problem seems to be a standard linear programming task which should can easily be solved by a "Solver" software. There used to be a so called "Solver" in google spreadsheet, but unfortunately it was removed from the newest version. If you are not insisting on Google solution, you should try it in one of the Solver-supported spreadsheet manager softwares.
I tried MS Office (it has a Solver add-in, installation guide: http://office.microsoft.com/en-001/excel-help/load-the-solver-add-in-HP010342660.aspx).
Before you run the solver, you should prepare your original dataset a bit, with helper columns and cells.
Add a new column next to the "Cost" column (let's assume it is column "D"), and under it put each row either 0, or 1. This column will tell you if a monster is selected to the attack team or not.
Add two more columns ("E" and "F" respectively). These columns will be products of the Attack and of the Cost respectively. So you should write a function to the E2 cell: =b2*d2, and for the F2 cell: =c2*d2. With this way if a monster is selected (which is told by the D column, remember), the appropriate E and F cells will be non zero values, aotherwise they will be 0.
Create a SUM row under the last row, and create a summarizing function for the D,E,F columns respectively. So in my spreadsheet D10 cell gets its value like this: =sum(d2:d9), and so on.
I created a spreadsheet to show these steps: https://docs.google.com/spreadsheets/d/1_7XRlupEEwat3CthSSz8h_yJ44MysK9hMsj0ijPEn18/edit?usp=sharing
Remember to copy this worksheet to an MS Office worksheet, before you start the Solver.
Now, you are ready to start the Solver. (Data menu, Solver in MS Office). You can see a video here on using the Solver: https://www.youtube.com/watch?v=Oyc0k9kiD7o
It's not that hard as it looks like, but for this case I'll describe what to write where:
Set Objective: you should select the "E10" cell, as that represents the sum of all the attack points.
Check "Max" radiobutton as we would like to maximize the value of the attacks.
By Changing variable cells: Select the "d2:d9" interval as those cells are representing whether a monster is selected or not. The solver will try to adjust these values (0, or 1) in order to maximise the sum attack.
Subject to the Contraints: Here we should add some constraints. Click on the Add button, and then:
First we should ensure that d2:d9 are all binary values. So "Cell reference" should be "d2:d9" and from the dropdown menu, select "bin" as binary.
Another constraint should be that the sum of the selected monsters should not exceed 5. So select the cell where the sum of the selected monsters is represented (D10) and add "<=" and the value "5"
Finally we cannot use more manna that we have, so select the cell in which you store the sum of used manna (F2), and "<=", and add the whole amount of manna we can spend in my case it's in the I2 cell).
Done. It should work, in my case it worked at least.
Hope it helps anyway.
I have a column of numbers in excel, with positives and negatives. It is an accounting book. I need to eliminate cells that sums to zero. It means I want to remove the subset, so the rest of element can not form any subset to sum to zero. I think this problem is to find the largest subset sum. By remove/eliminate, I mean to mark them in excel.
For example:
a set {1,-1,2,-2,3,-3,4,-4,5,-5,6,7,8,9},
I need a function that find subset {1,-1,2,-2,3,-3,4,-4,5,-5} and mark each element.
This suggestion may be a little heavy-handed, but it should be able to handle a broad class of problems -- like when one credit may be zeroed out by more than one debit (or vice versa) -- if that's what you want. Like you asked for, it will literally find the largest subset that sums to zero:
Enter your numbers in column A, say in the range A1:A14.
In column B, beside your numbers, enter 0 in each of the cells B1:B14. Eventually, these cells will be set to 1 if the corresponding number in column A is selected, or 0 if it isn't.
In cell C1, enter the formula =A1*B1. Copy the formula down to cells C2:C14.
At the bottom of column B, in cell B15, enter the formula =SUM(B1:B14). This formula calculates the count of your numbers that are selected.
At the bottom of column C, in cell C15, enter the formula =SUM(C1:C14). This formula calculates the sum of your numbers that are selected.
Activate the Solver Add-In and use it for the steps that follow.
Set the objective to maximize the value of cell $B$15 -- in other words, to maximize the count of your numbers that are selected (that is, to find the largest subset).
Set the following three constraints to require the values in cells B1:B14 (that indicate whether or not each of your numbers is selected) to be 0 or 1: a) $B$1:$B$14 >= 0, b) $B$1:$B$14 <= 1, and, c) $B$1:$B$14 = integer.
Set the following constraint to require the selected numbers to add up to 0: $C$15 = 0.
Use the Solver Add-In to solve the problem.
Hope this helps.
I think that you need to better define your problem because as it is currently stated there is no clear answer.
Here's why. Take this set of numbers:
{ -9, -5, -1, 6, 7, 10 }
There are 64 possible subsets - including the empty set - and of these three have zero sums:
{ -9, -1, 10 }, { -5, -1, 6 } & { }
There are two possible "biggest" zero-sum subsets.
If you remove either of these you end up with either of:
{ -5, 6, 7 } or { -9, 7, 10 }
Neither of these sum to zero, but there's no rule to determine which subset to pick.
You could decide to remove the "merged" set of zero sum subsets. This would leave you with:
{ 7 }
But does that make sense in your accounting package?
Equally you could just decide to eliminate only pairs of matching positive & negative numbers, but many transactions would involve triples (i.e. sale = cost + tax).
I'm not sure your question can be answered unless you describe your requirements more clearly.