If I have a function add_nums that takes 2 numbers and adds them, there are like infinite inputs that can be tested.
If I have a function shape_color that can take circle, triangle, square for the shapes and red, blue, for the colors, then there are 6 different states. But what if my function just returns if it is a circle or triangle. It only cares about 2 different color paths when it is a square. Do I test all 6 states or do I test only the 3 code paths?
I think code coverage like many things is a “it depends”.
I think 100% code coverage usually means that for every branch, there is some test that results in it going down that branch? Like, there’s no line of code (outside of potential exception handling code?) that isn’t “tested” by any test (where “tested” means “it gets run during the test”).
>> If I have a function add_nums that takes 2 numbers and adds them, there are like infinite inputs that can be tested.
That's what formal verification is for: you generate math statements from the code, and then prove them.
Testing is for covering the most common scenarios and likely edge cases. 100% coverage means every line of code in the app is executed when your test suite runs. It is useful as a bare minimum, but by itself does not guarantee that there are no bugs.
Of course they would, it would be the most valueable item on the planet (asuming there is an internet surrounding it). You could charge millions for todays 65" OLED TVs in 1980. The price for polio vaccine in 1920? Well, no billionaire would risk any of their offspring to suffer from polio.
We literally have billionaires flying to space and longing for other planets today - way more useless than a smartphone.
It is a hypothetical that you chose to not want to understand. Replace phone or flatscreen TV with something more available, such as a modern midrange car - gasoline/diesel and streets were widely available in 1920.
Or the option to cross the atlantic in a day instead of 3 weeks. Etc.
The whole point is, basically everything that is widely available to the broad population today wasn't even available to the ultra wealthy back then, let alone the broad population. People just take this stuff for granted nowadays.
Right which is fine. Where it veers of into absurdity is when people try and claim we are better off then the ultra wealthy of yesteryear because we have access to cellphones or transatlantic flights.
I click the upvote button and a number goes from 0 to 1. Somewhere else on the page a banner gets displayed saying you have upvotes.
Your javascript can target those 2 divs, ala doc.getElementById(counter).innerHtml and document.createElement.
Like that kind of works for simple stuff. But it gets more complicated fast. Reactivity is when your counter listens for change in the count and updates itself whenever that count changes.
That's why you wouldn't target those 2 divs directly, but have one dedicated place, in which you update the divs and call that place from any other place that needs to update the 2 divs.
Well, that's simplifying the situation, but as those situations become more and more in ones site, at some point one might switch to a mediator pattern, which kind of is very close to signal emit and listening for signals.
That is wild to me. I have been on the same low dose (30) of Vyvanse for damn near a decade now. I don’t take it on the weekends or vacation. I have zero desire to up my dose.
reply