Skip to content

notawhalea/MPP-Labs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HELLO WORLD! 🌍


Modern Platfors of Programming BSUIR(СПП БГУИР 5 сем)

It's my vision in some task.


What I've done

This is my solutions of five labs.


FIRST LAB😍

TRACER

Link on technical task

Here i implement a method execution time meter using the StackTrace system class.

The total execution time of the analyzed methods in one thread should also be calculated. To do this, it is enough to calculate the sum of the times of the "root" methods called from the thread. The trace results of nested methods should be presented in the appropriate place in the results tree. For time measurements, you should use the Stopwatch class.

The measurement result must be presented in three formats: JSON, XML and YAML. When implementing plugins, you should use ready-made libraries for working with these formats.


SECOND LAB😦

FAKER

Link on technical task

Here i implement an object generator with random test data.

When creating an object, you should use the constructor, and also fill in public fields and properties with public setters that were not filled in the constructor. Consider scenarios where a class has only a private constructor, multiple constructors, a constructor with parameters, and public fields/properties. If there are multiple constructors, the one with more parameters should be preferred, but if an exception occurs while trying to use it, the others should be tried. Note that user-defined value types, which are structures declared with the struct keyword, always have a parameterless constructor, but a user-defined constructor can be declared in addition to it (which should be tried first, guided by the logic of preference). constructor with many parameters). The padding must be recursive (if the field is another object, then it must also be created using Faker).

Creating collections should be done in the same way as creating other types that have generators.


THIRD LAB😚

DIRECTORY SCANNER

Link on technical task

Here i implement a graphical utility using WPF to analyze the size ratio of files and directories within a selected directory in multi-threaded mode.

File and directory size analysis

  • Analysis of the size of files and directories must be performed in multi-threaded mode using the system's thread pool and queue.
  • Each directory is processed on a separate thread. Processing includes summing the sizes of nested files and queuing all nested directories for similar processing.
  • The maximum number of involved threads should be limited (it can be a constant in the code) without changing the settings of the system thread pool (ThreadPool.SetMaxThreads is not allowed).

The thread processing a directory does not need to wait for all nested directories to be processed, but only queue their processing. Otherwise, if the nesting level is high, the threads will sit idle waiting for threads running for nested directories to finish.

Also, when the limit on the number of involved threads is set to a value that is less than the level of nesting of directories in the scanned directory, the program may "hang" due to infinite waiting (mutual blocking), when all threads are busy waiting for the completion of traversal of nested directories, for which there are no threads to start processing. remains.

To solve this problem, the recalculation of the sizes of directories, taking into account nested directories, must be performed separately, after the sizes of all files have been calculated.


FOURTH LAB😝

TESTS GENERATOR

Link on technical task

Here i implement a multi-threaded test class boilerplate generator for one of the testing libraries (NUnit, xUnit, MSTest) for the classes under test.

Input data

  • List of files for classes from which it is necessary to generate test classes.
  • Path to the folder where the generated files will be written.
  • Restrictions on conveyor sections (see below).

Output data

  • Test class files: Each output file should have only one test class corresponding to one test class, regardless of where the test classes were located in the source files. For example: Input.cs (with classes Foo and Bar) -> FooTests.cs, BarTests.cs.
  • All generated test classes should compile when included in a separate project that has a reference to the project with the classes under test.
  • All generated tests must fail.

Generation should be performed in a producer-consumer pipeline and consist of three stages:

  1. parallel loading of sources into memory (with a limit on the number of files loaded at a time);
  2. generation of test classes in multi-threaded mode (with a limit on the maximum number of simultaneously processed tasks);
  3. parallel writing of results to disk (with a limit on the number of simultaneously written files).

FIFTH LAB😲

STRING FORMATTER

Link on technical task

Here i implement a StringFormatter class with a single Format method that should do a simplified "string interpolation".

For simplified access to a ready-made formatter instance, it is recommended to declare a static field in the class implementation with the created "default" instance

Full string interpolation has been available since C# 6.0 and allows you to perform in-place substitution of variables, fields, properties, and expressions in string literals: int a = 2021; string = "spp"; string result = $"{s.ToUpper()}-{a+1}"; // SPP-2022

In this lab, you need to implement a simplified string interpolation, when only the fields and properties of the passed object are substituted.

Expressions should only be compiled once and stored as delegates. The cache must be thread-safe because the Format method can be called simultaneously from multiple threads. The operation of the Formatter should be fully verified with unit tests. The use of an auxiliary console program for this is prohibited.


I just relax and gained experience here.

Link on technical task for all labs

Still in progress? Convert to draft!:wink:

And no one ever knows.She's on my mind when I'm on yours, oh.I'm not here for games.I told you what it is, you chose to stay, oh.Baby, you chose the pain.Cause you don't know me, you just know my name.:microphone:Renegade - Aaryan Shah