ibbles / LearningUnrealEngine

[Deprecated, see LearningUnreal instead.] A bunch of notes and code snippets that I write while figuring out how to use the Unreal Engine.
Creative Commons Zero v1.0 Universal
327 stars 53 forks source link

Unit tests source notes.md #2

Open Floating-Island opened 2 years ago

Floating-Island commented 2 years ago

Hi, A while ago I created some tutorials on creating a CI environment for UE4 and considerations for running C++ tests. Maybe they'll be useful for: Unit tests source notes.md.

I leave the links here:

ibbles commented 2 years ago

Thanks! I'll have a look.

ibbles commented 2 years ago

This is great! It explains exactly what I'm trying to do and even in the same order that I myself was discovering the test system, and it goes past where I got stuck (world ticking) the last time I tried to write this kind of unit test. Very helpful. And the list of resources at the end of the first page will keep me occupied for a while. :+1:

I have one question and one comment.

The question is about double-typed casts, such as AJet* testJet = Cast<AJet, AActor>(UGameplayStatics::GetActorOfClass(testWorld, AJet::StaticClass()));. I have only seen the single-type Cast<AJet>(...) form before. What is the advantage of the double-typed form?

The comment is about the links to GitHub at the end of Part I: Worlds, Ticks and Forces. It is possible to link to a set of lines and I recommend linking to a something stable, such as a tag or a commit, instead of to master since adding or removing lines above the target line will make the link point to something other than was intended.

For example:
https://github.com/Floating-Island/UE4-TDD-CI_Testing/blob/99d1315df8ac24f5aa48d3f0eea3433f14f2d6e5/Source/CITesting/Tests/AcceleratingPawnTest.cpp#L186-L193

Floating-Island commented 2 years ago

Hi Martin!

Sorry for the late reply.

The double typed cast is only used because the compiler complained about the single type cast when casting inside latent commands.

About the links to lines, you're totally right. I was lazy and linked to lines instead of commits. I'll fix it soon.

Thanks for adding the tutorial! :D

On Wed, Apr 27, 2022, 11:55 Martin Nilsson @.***> wrote:

This is great! It explains exactly what I'm trying to do and even in the same order that I myself was discovering the test system, and it goes past where I got stuck (world ticking) the last time I tried to write this kind of unit test. Very helpful. And the list of resources at the end of the first page will keep me occupied for a while. 👍

I have one question and one comment.

The question is about double-typed casts, such as AJet* testJet = Cast<AJet, AActor>(UGameplayStatics::GetActorOfClass(testWorld, AJet::StaticClass()));. I have only seen the single-type Cast(...) form before. What is the advantage of the double-typed form?

The comment is about the links to GitHub at the end of Part I: Worlds, Ticks and Forces. It is possible to link to a set of lines and I recommend linking to a something stable, such as a tag or a commit, instead of to master since adding or removing lines above the target line will make the link point to something other than was intended.

For example:

https://github.com/Floating-Island/UE4-TDD-CI_Testing/blob/99d1315df8ac24f5aa48d3f0eea3433f14f2d6e5/Source/CITesting/Tests/AcceleratingPawnTest.cpp#L186-L193

— Reply to this email directly, view it on GitHub https://github.com/ibbles/LearningUnrealEngine/issues/2#issuecomment-1110805443, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEGXP5IAQ5S7RKCIIUNSFWLVHEFKBANCNFSM5S7Z5LVA . You are receiving this because you authored the thread.Message ID: @.***>