Re: [racket-users] Confused about testing web applications

2019-05-31 Thread Jesse Alama
In addition to Jay's suggestion, if you're doing something JSONy (that 
is, if your HTTP response bodies are JSON) consider using Riposte 
(https://riposte.in). It's a DSL for testing such web applications. (But 
only if you're serving JSON. Riposte currently doesn't help if you're 
serving up HTML or something else.)


On 30 May 2019, at 20:28, Jay McCarthy wrote:


You may be interesting in the `web-server/test` library:

https://docs.racket-lang.org/web-server/test.html

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.

On Thu, May 30, 2019 at 2:24 PM Comrade SparklePony
 wrote:


Hello,

I'm new to Racket, and to gain facility with it I have been 
trying to write small webapps, i.e. a simple calculator, using the 
built-in web framework. However, I have found myself stuck when 
trying to implement tests for some of the functions the webapp 
provides-- I am not sure how to test functions that process a 
request. Specifically, I'm trying to write tests for an 
"process-request" function which turns a request into a Calculator 
struct. I'm confused if this is one of the unlikely scenarios in 
which a request struct needs to be made, or if there is a better way 
to generate a request with certain bindings.


If a request struct does need to be made, can I just place an 
arbitrary instance of the required data type in each field (except 
for bindings/raw-promise)? I can just place a list of binding:form in 
the bindings/raw-promise field, right?


I apologize if I missed something obvious or this is an obnoxious 
noob question.


Some information that may or may not be helpful:
- Racket experience so far: completed HTDP, webapp tutorial.
- Sources consulted so far:
- Racket documentation on HTTP, formlets, testing servlets, 
rackunit, contracts, and delayed evaluation.
- Racket webapps hosted on github (I couldn't find any that 
had used tests)

- Github link of the project so far

Thank you.

--
You received this message because you are subscribed to the Google 
Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/637db0d5-47a8-4fb6-a2a5-b79fc58a2672%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJYbDamg1ZMmYKFbZ6d6LLmmbdR2wD1Pzq_cmRL5a3Zu%2BksYGg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/63F638B2-09F8-4C23-8552-4E314731FB8A%40lisp.sh.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] anyone using single-flonums?

2019-05-31 Thread Konrad Hinsen
Matthew Flatt  writes:

> At Thu, 30 May 2019 12:10:37 +0200, Konrad Hinsen wrote:
>>
>> Right now, no, but I have used them briefly in a past project, for 
>> testing the impact of single-precision on a numerical algorithm.
>
> Thanks for replying!
>
> Would using `math/bigfloat` (where you get to pick the precision) have
> worked in that case? In a small example, I imagine you could import
> `math/bigfloat` and strip the `bf` prefix using `filtered-in` to
> replace the usual arithmetic operations with bigfloat variants. But I
> expect that would become painful in a larger example, especially if
> multiple modules are involved.

Right. Yes, math/bigfloat is a good substitute in my situation.  Even a
better one because it permits a detailed exploration of the impact of
varying precision.

My test case was a small algorithm, implemented as four functions in a
single module, so adapting the code would not have been a problem, but
as you say, it risks being a pain for bigger code. Perhaps someone
will do #lang bigfloat one day, that would be the perfect tool for
the kind of work I did back then - but which probably few people
in the Racket community will ever do.

Konrad.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/m1sgsvytse.fsf%40ordinateur-de-catherine--konrad.home.
For more options, visit https://groups.google.com/d/optout.