--- Begin Message ---
Op 27-4-2020 om 19:16 schreef Richard Sargent:
On Mon, Apr 27, 2020 at 9:30 AM Roelof Wobben <r.wob...@home.nl> wrote:
Op 27-4-2020 om 18:28 schreef Richard Sargent:
On Mon, Apr 27, 2020 at 1:56 AM Roelof Wobben via Pharo-users <pharo-users@lists.pharo.org> wrote:
Hello,

I have to test the server which should return the string but then in
uppercase.

So far I have this :
https://github.com/RoelofWobben/Network-simulator/blob/master/src/NetworkSimulator-Tests/KANetworkTest.class.st#L79

but I fail to see how I can test that the package sending back is a
uppercase string.

I think you need to rephrase this question. Either the String class hierarchy has a method named something like #isUppercase or Character does. If only Character has it, you would need to iterate over the received string testing each individual character.

Or is your question more about getting the response back to the sending node?


yep, I want to test if the response back to the sending node is the same string as the sending node is but then all uppercased.

Assuming you have the code written that sends a request packet to a server, then makes the server process it and send a response packet back to the original node, the following pseudo-code should show you one way.

| requestPacket responsePacket |
requestPacket := ...
... send the request and get a response back ...
responsePacket := self sendingNode nextReceivedPacket.

self assert: responsePacket payload isUppercase description: 'Response should have been uppercase'.
self assert: (requestPacket payload equals: responsePacket payload ignoreCase: true) description: 'Response is not the same string'.

Those methods probably exist in Pharo, or something very similar. e.g. it might be #equalsIgnoreCase:.


oke,

I think I can move forward.
I have some ideas how to make this work but have to try some things.

Thanks

Roelof


--- End Message ---

Reply via email to