News for hackers. Stuff that matters.
Re:We should be more ambitious with the software we build by huijzer on Monday October 26, 2026 @12:43PM (#50246803)
Say we have a trivial function like this

    func below_ten()
      if 10 < x
        println(“true”)
      else
        println(“false”)
      end
    end
Now what would a test for these two paths test? It would basically be writing down the same - easy to understand logic - in a less generalized way. Good perhaps to ensure that this function doesn’t accidentally change over time but apart from that it wouldn’t add much value.
Re:We should be more ambitious with the software we build by thunky on Monday October 26, 2026 @06:33PM (#50252061)
> It would basically be writing down the same - easy to understand logic

Perhaps this is a sign that this function isn't necessary.

Re:We should be more ambitious with the software we build by AndrewKemendo on Monday October 26, 2026 @08:56PM (#50253403)
Exactly. If the function is already verified to be correct, then the unit and integration tests will determine if the function is appropriate for the context.

Unit tests aren't for verifying functions.

Re:We should be more ambitious with the software we build by cvz on Wednesday October 28, 2026 @04:40PM (#50280578)
A test would possibly have caught that the condition in this trivial function is backwards.
Re:We should be more ambitious with the software we build by guenthert on Monday November 02, 2026 @08:31AM (#50336592)
Lol, yes. This also demonstrates why tests ought to be written by an independent party.