ADAPT-Chase commited on
Commit
b1f9669
·
verified ·
1 Parent(s): 09397c1

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. projects/ui/serena-new/test/resources/repos/clojure/test_repo/src/test_app/core.clj +23 -0
  2. projects/ui/serena-new/test/resources/repos/clojure/test_repo/src/test_app/utils.clj +17 -0
  3. projects/ui/serena-new/test/resources/repos/csharp/test_repo/.gitignore +37 -0
  4. projects/ui/serena-new/test/resources/repos/csharp/test_repo/Models/Person.cs +34 -0
  5. projects/ui/serena-new/test/resources/repos/csharp/test_repo/Program.cs +43 -0
  6. projects/ui/serena-new/test/resources/repos/csharp/test_repo/TestProject.csproj +10 -0
  7. projects/ui/serena-new/test/resources/repos/csharp/test_repo/serena.sln +38 -0
  8. projects/ui/serena-new/test/resources/repos/dart/test_repo/.gitignore +23 -0
  9. projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/helper.dart +48 -0
  10. projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/main.dart +130 -0
  11. projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/models.dart +174 -0
  12. projects/ui/serena-new/test/resources/repos/dart/test_repo/pubspec.yaml +11 -0
  13. projects/ui/serena-new/test/resources/repos/elixir/test_repo/.gitignore +0 -0
  14. projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/examples.ex +211 -0
  15. projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/models.ex +166 -0
  16. projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/services.ex +257 -0
  17. projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/test_repo.ex +31 -0
  18. projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/utils.ex +48 -0
  19. projects/ui/serena-new/test/resources/repos/elixir/test_repo/mix.exs +25 -0
  20. projects/ui/serena-new/test/resources/repos/elixir/test_repo/mix.lock +6 -0
projects/ui/serena-new/test/resources/repos/clojure/test_repo/src/test_app/core.clj ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (ns test-app.core)
2
+
3
+ (defn greet
4
+ "A simple greeting function"
5
+ [name]
6
+ (str "Hello, " name "!"))
7
+
8
+ (defn add
9
+ "Adds two numbers"
10
+ [a b]
11
+ (+ a b))
12
+
13
+ (defn multiply
14
+ "Multiplies two numbers"
15
+ [a b]
16
+ (* a b))
17
+
18
+ (defn -main
19
+ "Main entry point"
20
+ [& args]
21
+ (println (greet "World"))
22
+ (println "2 + 3 =" (add 2 3))
23
+ (println "4 * 5 =" (multiply 4 5)))
projects/ui/serena-new/test/resources/repos/clojure/test_repo/src/test_app/utils.clj ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (ns test-app.utils
2
+ (:require [test-app.core :as core]))
3
+
4
+ (defn calculate-area
5
+ "Calculates the area of a rectangle"
6
+ [width height]
7
+ (core/multiply width height))
8
+
9
+ (defn format-greeting
10
+ "Formats a greeting message"
11
+ [name]
12
+ (str "Welcome, " (core/greet name)))
13
+
14
+ (defn sum-list
15
+ "Sums a list of numbers"
16
+ [numbers]
17
+ (reduce core/add 0 numbers))
projects/ui/serena-new/test/resources/repos/csharp/test_repo/.gitignore ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build results
2
+ [Dd]ebug/
3
+ [Dd]ebugPublic/
4
+ [Rr]elease/
5
+ [Rr]eleases/
6
+ x64/
7
+ x86/
8
+ [Aa][Rr][Mm]/
9
+ [Aa][Rr][Mm]64/
10
+ bld/
11
+ [Bb]in/
12
+ [Oo]bj/
13
+ [Ll]og/
14
+ [Ll]ogs/
15
+
16
+ # Visual Studio temporary files
17
+ .vs/
18
+
19
+ # .NET Core
20
+ project.lock.json
21
+ project.fragment.lock.json
22
+ artifacts/
23
+
24
+ # Files built by Visual Studio
25
+ *.user
26
+ *.userosscache
27
+ *.sln.docstates
28
+
29
+ # Build results
30
+ *.dll
31
+ *.exe
32
+ *.pdb
33
+
34
+ # NuGet
35
+ *.nupkg
36
+ *.snupkg
37
+ packages/
projects/ui/serena-new/test/resources/repos/csharp/test_repo/Models/Person.cs ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using TestProject;
2
+
3
+ namespace TestProject.Models
4
+ {
5
+ public class Person
6
+ {
7
+ public string Name { get; set; }
8
+ public int Age { get; set; }
9
+ public string Email { get; set; }
10
+
11
+ public Person(string name, int age, string email)
12
+ {
13
+ Name = name;
14
+ Age = age;
15
+ Email = email;
16
+ }
17
+
18
+ public override string ToString()
19
+ {
20
+ return $"{Name} ({Age}) - {Email}";
21
+ }
22
+
23
+ public bool IsAdult()
24
+ {
25
+ return Age >= 18;
26
+ }
27
+
28
+ public int CalculateYearsUntilRetirement()
29
+ {
30
+ var calculator = new Calculator();
31
+ return calculator.Subtract(65, Age);
32
+ }
33
+ }
34
+ }
projects/ui/serena-new/test/resources/repos/csharp/test_repo/Program.cs ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+
3
+ namespace TestProject
4
+ {
5
+ class Program
6
+ {
7
+ static void Main(string[] args)
8
+ {
9
+ Console.WriteLine("Hello, World!");
10
+
11
+ var calculator = new Calculator();
12
+ int result = calculator.Add(5, 3);
13
+ Console.WriteLine($"5 + 3 = {result}");
14
+ }
15
+ }
16
+
17
+ public class Calculator
18
+ {
19
+ public int Add(int a, int b)
20
+ {
21
+ return a + b;
22
+ }
23
+
24
+ public int Subtract(int a, int b)
25
+ {
26
+ return a - b;
27
+ }
28
+
29
+ public int Multiply(int a, int b)
30
+ {
31
+ return a * b;
32
+ }
33
+
34
+ public double Divide(int a, int b)
35
+ {
36
+ if (b == 0)
37
+ {
38
+ throw new DivideByZeroException("Cannot divide by zero");
39
+ }
40
+ return (double)a / b;
41
+ }
42
+ }
43
+ }
projects/ui/serena-new/test/resources/repos/csharp/test_repo/TestProject.csproj ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <OutputType>Exe</OutputType>
5
+ <TargetFramework>net8.0</TargetFramework>
6
+ <ImplicitUsings>enable</ImplicitUsings>
7
+ <Nullable>enable</Nullable>
8
+ </PropertyGroup>
9
+
10
+ </Project>
projects/ui/serena-new/test/resources/repos/csharp/test_repo/serena.sln ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Microsoft Visual Studio Solution File, Format Version 12.00
2
+ # Visual Studio Version 17
3
+ VisualStudioVersion = 17.5.2.0
4
+ MinimumVisualStudioVersion = 10.0.40219.1
5
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0C88DD14-F956-CE84-757C-A364CCF449FC}"
6
+ EndProject
7
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "resources", "resources", "{EF7103B4-4C75-1E6D-A485-A154A88D107A}"
8
+ EndProject
9
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "repos", "repos", "{E2326EEF-E677-6A44-0935-7677816F09E7}"
10
+ EndProject
11
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{C21E6CE7-177A-86D9-040F-A317F18B6DBF}"
12
+ EndProject
13
+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "test\resources\repos\csharp\test_repo\TestProject.csproj", "{A4D04E18-760A-73F9-3303-0542F6298C84}"
14
+ EndProject
15
+ Global
16
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
17
+ Debug|Any CPU = Debug|Any CPU
18
+ Release|Any CPU = Release|Any CPU
19
+ EndGlobalSection
20
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
21
+ {A4D04E18-760A-73F9-3303-0542F6298C84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22
+ {A4D04E18-760A-73F9-3303-0542F6298C84}.Debug|Any CPU.Build.0 = Debug|Any CPU
23
+ {A4D04E18-760A-73F9-3303-0542F6298C84}.Release|Any CPU.ActiveCfg = Release|Any CPU
24
+ {A4D04E18-760A-73F9-3303-0542F6298C84}.Release|Any CPU.Build.0 = Release|Any CPU
25
+ EndGlobalSection
26
+ GlobalSection(SolutionProperties) = preSolution
27
+ HideSolutionNode = FALSE
28
+ EndGlobalSection
29
+ GlobalSection(NestedProjects) = preSolution
30
+ {EF7103B4-4C75-1E6D-A485-A154A88D107A} = {0C88DD14-F956-CE84-757C-A364CCF449FC}
31
+ {E2326EEF-E677-6A44-0935-7677816F09E7} = {EF7103B4-4C75-1E6D-A485-A154A88D107A}
32
+ {C21E6CE7-177A-86D9-040F-A317F18B6DBF} = {E2326EEF-E677-6A44-0935-7677816F09E7}
33
+ {A4D04E18-760A-73F9-3303-0542F6298C84} = {C21E6CE7-177A-86D9-040F-A317F18B6DBF}
34
+ EndGlobalSection
35
+ GlobalSection(ExtensibilityGlobals) = postSolution
36
+ SolutionGuid = {BDCA748E-D888-4BAF-BF24-DAC683113BFC}
37
+ EndGlobalSection
38
+ EndGlobal
projects/ui/serena-new/test/resources/repos/dart/test_repo/.gitignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Files and directories created by pub
2
+ .dart_tool/
3
+ .packages
4
+ pubspec.lock
5
+ build/
6
+
7
+ # If you're building an application, you may want to check-in your pubspec.lock
8
+ # pubspec.lock
9
+
10
+ # Directory created by dartdoc
11
+ doc/api/
12
+
13
+ # dotenv environment variables file
14
+ .env*
15
+
16
+ # Avoid committing generated Javascript files
17
+ *.dart.js
18
+ *.info.json # Produced by the --dump-info flag.
19
+ *.js # When generated by dart2js. Don't specify *.js if your
20
+ # project includes source files written in JavaScript.
21
+ *.js_
22
+ *.js.deps
23
+ *.js.map
projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/helper.dart ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// Helper functions for mathematical operations
2
+ library helper;
3
+
4
+ /// Performs subtraction of two integers
5
+ int subtract(int a, int b) {
6
+ return a - b;
7
+ }
8
+
9
+ /// Multiplies two numbers
10
+ double multiply(double x, double y) {
11
+ return x * y;
12
+ }
13
+
14
+ /// A utility class for mathematical operations
15
+ class MathHelper {
16
+ /// Calculates the power of a number
17
+ static double power(double base, int exponent) {
18
+ double result = 1.0;
19
+ for (int i = 0; i < exponent; i++) {
20
+ result *= base;
21
+ }
22
+ return result;
23
+ }
24
+
25
+ /// Calculates the square root approximation
26
+ double sqrt(double number) {
27
+ if (number < 0) {
28
+ throw ArgumentError('Cannot calculate square root of negative number');
29
+ }
30
+
31
+ double guess = number / 2;
32
+ for (int i = 0; i < 10; i++) {
33
+ guess = (guess + number / guess) / 2;
34
+ }
35
+ return guess;
36
+ }
37
+ }
38
+
39
+ /// An enumeration for operation types
40
+ enum OperationType {
41
+ addition,
42
+ subtraction,
43
+ multiplication,
44
+ division
45
+ }
46
+
47
+ /// A record for representing mathematical operations
48
+ typedef Operation = ({OperationType type, double operand1, double operand2});
projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/main.dart ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import 'helper.dart';
2
+
3
+ /// Main calculator class demonstrating various Dart features
4
+ class Calculator {
5
+ /// Private field for storing history
6
+ final List<String> _history = [];
7
+
8
+ /// Getter for accessing calculation history
9
+ List<String> get history => List.unmodifiable(_history);
10
+
11
+ /// Adds two integers and records the operation
12
+ int add(int a, int b) {
13
+ final result = a + b;
14
+ _history.add('$a + $b = $result');
15
+ return result;
16
+ }
17
+
18
+ /// Subtracts two integers using the helper function
19
+ int performSubtract(int a, int b) {
20
+ final result = subtract(a, b); // Reference to imported function
21
+ _history.add('$a - $b = $result');
22
+ return result;
23
+ }
24
+
25
+ /// Multiplies two numbers using helper class
26
+ double performMultiply(double x, double y) {
27
+ final result = multiply(x, y); // Reference to imported function
28
+ _history.add('$x * $y = $result');
29
+ return result;
30
+ }
31
+
32
+ /// Divides two numbers with error handling
33
+ double divide(double dividend, double divisor) {
34
+ if (divisor == 0) {
35
+ throw ArgumentError('Division by zero is not allowed');
36
+ }
37
+ final result = dividend / divisor;
38
+ _history.add('$dividend / $divisor = $result');
39
+ return result;
40
+ }
41
+
42
+ /// Clears the calculation history
43
+ void clearHistory() {
44
+ _history.clear();
45
+ }
46
+
47
+ /// Performs a complex calculation using multiple operations
48
+ double complexCalculation(double a, double b, double c) {
49
+ final step1 = add(a.toInt(), b.toInt()).toDouble(); // Reference to add method
50
+ final step2 = MathHelper.power(step1, 2); // Reference to helper class method
51
+ final result = step2 + c;
52
+ _history.add('Complex: ($a + $b)^2 + $c = $result');
53
+ return result;
54
+ }
55
+ }
56
+
57
+ /// A mixin for providing logging functionality
58
+ mixin LoggerMixin {
59
+ void log(String message) {
60
+ print('[${DateTime.now()}] $message');
61
+ }
62
+ }
63
+
64
+ /// An abstract class for defining calculators
65
+ abstract class CalculatorInterface {
66
+ int add(int a, int b);
67
+ int subtract(int a, int b);
68
+ }
69
+
70
+ /// Advanced calculator that extends Calculator and uses mixin
71
+ class AdvancedCalculator extends Calculator
72
+ with LoggerMixin
73
+ implements CalculatorInterface {
74
+
75
+ /// Performs scientific calculation with logging
76
+ double scientificOperation(Operation operation) {
77
+ log('Performing ${operation.type} operation');
78
+
79
+ switch (operation.type) {
80
+ case OperationType.addition:
81
+ return operation.operand1 + operation.operand2;
82
+ case OperationType.subtraction:
83
+ return operation.operand1 - operation.operand2;
84
+ case OperationType.multiplication:
85
+ return operation.operand1 * operation.operand2;
86
+ case OperationType.division:
87
+ if (operation.operand2 == 0) {
88
+ throw ArgumentError('Division by zero');
89
+ }
90
+ return operation.operand1 / operation.operand2;
91
+ }
92
+ }
93
+
94
+ /// Factory constructor for creating calculators
95
+ factory AdvancedCalculator.withLogger() {
96
+ return AdvancedCalculator();
97
+ }
98
+ }
99
+
100
+ /// Program entry point
101
+ class Program {
102
+ /// Main method demonstrating calculator usage
103
+ static void main(List<String> args) {
104
+ final calc = Calculator();
105
+ final result1 = calc.add(5, 3); // Reference to add method
106
+ final result2 = calc.performSubtract(10, 4); // Reference to performSubtract method
107
+ final result3 = calc.performMultiply(2.5, 4.0); // Reference to performMultiply method
108
+
109
+ print('Addition result: $result1');
110
+ print('Subtraction result: $result2');
111
+ print('Multiplication result: $result3');
112
+
113
+ // Using advanced calculator
114
+ final advancedCalc = AdvancedCalculator.withLogger();
115
+ final operation = (
116
+ type: OperationType.multiplication,
117
+ operand1: 3.14,
118
+ operand2: 2.0
119
+ );
120
+
121
+ final scientificResult = advancedCalc.scientificOperation(operation);
122
+ print('Scientific result: $scientificResult');
123
+
124
+ // Display calculation history
125
+ print('Calculation History:');
126
+ for (final entry in calc.history) {
127
+ print(' $entry');
128
+ }
129
+ }
130
+ }
projects/ui/serena-new/test/resources/repos/dart/test_repo/lib/models.dart ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// Data models for the test application
2
+ library models;
3
+
4
+ /// Represents a user in the system
5
+ class User {
6
+ /// User's unique identifier
7
+ final int id;
8
+
9
+ /// User's name
10
+ final String name;
11
+
12
+ /// User's email address
13
+ final String email;
14
+
15
+ /// User's age
16
+ int _age;
17
+
18
+ /// Constructor for creating a User
19
+ User(this.id, this.name, this.email, this._age);
20
+
21
+ /// Named constructor for creating a user with default values
22
+ User.withDefaults(this.id, this.name)
23
+ : email = '$name@example.com',
24
+ _age = 0;
25
+
26
+ /// Getter for user's age
27
+ int get age => _age;
28
+
29
+ /// Setter for user's age with validation
30
+ set age(int value) {
31
+ if (value < 0 || value > 150) {
32
+ throw ArgumentError('Age must be between 0 and 150');
33
+ }
34
+ _age = value;
35
+ }
36
+
37
+ /// Checks if the user is an adult
38
+ bool get isAdult => _age >= 18;
39
+
40
+ /// Returns a string representation of the user
41
+ @override
42
+ String toString() {
43
+ return 'User(id: $id, name: $name, email: $email, age: $_age)';
44
+ }
45
+
46
+ /// Checks equality based on user ID
47
+ @override
48
+ bool operator ==(Object other) {
49
+ if (identical(this, other)) return true;
50
+ return other is User && other.id == id;
51
+ }
52
+
53
+ @override
54
+ int get hashCode => id.hashCode;
55
+ }
56
+
57
+ /// Represents a product in an e-commerce system
58
+ class Product {
59
+ final String id;
60
+ final String name;
61
+ final double price;
62
+ final String category;
63
+ int _stock;
64
+
65
+ Product(this.id, this.name, this.price, this.category, this._stock);
66
+
67
+ /// Getter for current stock
68
+ int get stock => _stock;
69
+
70
+ /// Reduces stock by the specified amount
71
+ bool reduceStock(int amount) {
72
+ if (amount <= 0) {
73
+ throw ArgumentError('Amount must be positive');
74
+ }
75
+ if (_stock >= amount) {
76
+ _stock -= amount;
77
+ return true;
78
+ }
79
+ return false;
80
+ }
81
+
82
+ /// Increases stock by the specified amount
83
+ void increaseStock(int amount) {
84
+ if (amount <= 0) {
85
+ throw ArgumentError('Amount must be positive');
86
+ }
87
+ _stock += amount;
88
+ }
89
+
90
+ /// Checks if the product is in stock
91
+ bool get isInStock => _stock > 0;
92
+
93
+ /// Calculates the total value of stock
94
+ double get totalStockValue => _stock * price;
95
+ }
96
+
97
+ /// An abstract base class for different types of accounts
98
+ abstract class Account {
99
+ final String accountNumber;
100
+ double _balance;
101
+
102
+ Account(this.accountNumber, this._balance);
103
+
104
+ double get balance => _balance;
105
+
106
+ /// Abstract method that must be implemented by subclasses
107
+ bool withdraw(double amount);
108
+
109
+ /// Deposits money into the account
110
+ void deposit(double amount) {
111
+ if (amount <= 0) {
112
+ throw ArgumentError('Deposit amount must be positive');
113
+ }
114
+ _balance += amount;
115
+ }
116
+ }
117
+
118
+ /// A savings account implementation
119
+ class SavingsAccount extends Account {
120
+ final double interestRate;
121
+
122
+ SavingsAccount(super.accountNumber, super.balance, this.interestRate);
123
+
124
+ @override
125
+ bool withdraw(double amount) {
126
+ if (amount <= 0) {
127
+ throw ArgumentError('Withdrawal amount must be positive');
128
+ }
129
+ if (_balance >= amount) {
130
+ _balance -= amount;
131
+ return true;
132
+ }
133
+ return false;
134
+ }
135
+
136
+ /// Applies interest to the account balance
137
+ void applyInterest() {
138
+ _balance += _balance * interestRate / 100;
139
+ }
140
+ }
141
+
142
+ /// Generic container class demonstrating type parameters
143
+ class Container<T> {
144
+ final List<T> _items = [];
145
+
146
+ /// Adds an item to the container
147
+ void add(T item) {
148
+ _items.add(item);
149
+ }
150
+
151
+ /// Removes an item from the container
152
+ bool remove(T item) {
153
+ return _items.remove(item);
154
+ }
155
+
156
+ /// Gets all items in the container
157
+ List<T> get items => List.unmodifiable(_items);
158
+
159
+ /// Gets the number of items
160
+ int get length => _items.length;
161
+
162
+ /// Checks if the container is empty
163
+ bool get isEmpty => _items.isEmpty;
164
+
165
+ /// Finds the first item matching the predicate
166
+ T? find(bool Function(T) predicate) {
167
+ for (final item in _items) {
168
+ if (predicate(item)) {
169
+ return item;
170
+ }
171
+ }
172
+ return null;
173
+ }
174
+ }
projects/ui/serena-new/test/resources/repos/dart/test_repo/pubspec.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: test_repo
2
+ description: A test repository for Serena Dart language server testing
3
+ version: 1.0.0
4
+
5
+ environment:
6
+ sdk: '>=3.0.0 <4.0.0'
7
+
8
+ dependencies:
9
+
10
+ dev_dependencies:
11
+ lints: ^3.0.0
projects/ui/serena-new/test/resources/repos/elixir/test_repo/.gitignore ADDED
File without changes
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/examples.ex ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo.Examples do
2
+ @moduledoc """
3
+ Examples module demonstrating usage of models and services.
4
+ Similar to Python's examples directory, this shows how different modules work together.
5
+ """
6
+
7
+ alias TestRepo.Models.{User, Item}
8
+ alias TestRepo.Services.{UserService, ItemService, OrderService}
9
+
10
+ defmodule UserManagement do
11
+ @doc """
12
+ Creates a complete user workflow example.
13
+ """
14
+ def run_user_example do
15
+ # Start user service
16
+ {:ok, user_service} = UserService.start_link()
17
+
18
+ # Create users
19
+ {:ok, alice} = UserService.create_user(user_service, "1", "Alice", "alice@example.com", ["admin"])
20
+ {:ok, bob} = UserService.create_user(user_service, "2", "Bob", "bob@example.com", ["user"])
21
+
22
+ # Get users
23
+ {:ok, retrieved_alice} = UserService.get_user(user_service, "1")
24
+
25
+ # List all users
26
+ all_users = UserService.list_users(user_service)
27
+
28
+ # Clean up
29
+ GenServer.stop(user_service)
30
+
31
+ %{
32
+ created_alice: alice,
33
+ created_bob: bob,
34
+ retrieved_alice: retrieved_alice,
35
+ all_users: all_users
36
+ }
37
+ end
38
+
39
+ @doc """
40
+ Demonstrates user role management.
41
+ """
42
+ def manage_user_roles do
43
+ user = User.new("role_user", "Role User", "role@example.com")
44
+
45
+ # Add roles
46
+ user_with_admin = User.add_role(user, "admin")
47
+ user_with_multiple = User.add_role(user_with_admin, "moderator")
48
+
49
+ # Check roles
50
+ has_admin = User.has_role?(user_with_multiple, "admin")
51
+ has_guest = User.has_role?(user_with_multiple, "guest")
52
+
53
+ %{
54
+ original_user: user,
55
+ user_with_roles: user_with_multiple,
56
+ has_admin: has_admin,
57
+ has_guest: has_guest
58
+ }
59
+ end
60
+ end
61
+
62
+ defmodule ShoppingExample do
63
+ @doc """
64
+ Creates a complete shopping workflow.
65
+ """
66
+ def run_shopping_example do
67
+ # Create user and items
68
+ user = User.new("customer1", "Customer One", "customer@example.com")
69
+ item1 = Item.new("widget1", "Super Widget", 19.99, "electronics")
70
+ item2 = Item.new("gadget1", "Cool Gadget", 29.99, "electronics")
71
+
72
+ # Create order
73
+ order = OrderService.create_order("order1", user)
74
+
75
+ # Add items to order
76
+ order_with_item1 = OrderService.add_item_to_order(order, item1)
77
+ order_with_items = OrderService.add_item_to_order(order_with_item1, item2)
78
+
79
+ # Process the order
80
+ processed_order = OrderService.process_order(order_with_items)
81
+ completed_order = OrderService.complete_order(processed_order)
82
+
83
+ %{
84
+ user: user,
85
+ items: [item1, item2],
86
+ final_order: completed_order,
87
+ total_cost: completed_order.total
88
+ }
89
+ end
90
+
91
+ @doc """
92
+ Demonstrates item filtering and searching.
93
+ """
94
+ def item_filtering_example do
95
+ # Start item service
96
+ {:ok, item_service} = ItemService.start_link()
97
+
98
+ # Create various items
99
+ ItemService.create_item(item_service, "laptop", "Gaming Laptop", 1299.99, "electronics")
100
+ ItemService.create_item(item_service, "book", "Elixir Guide", 39.99, "books")
101
+ ItemService.create_item(item_service, "phone", "Smartphone", 699.99, "electronics")
102
+ ItemService.create_item(item_service, "novel", "Great Novel", 19.99, "books")
103
+
104
+ # Get all items
105
+ all_items = ItemService.list_items(item_service)
106
+
107
+ # Filter by category
108
+ electronics = ItemService.list_items(item_service, "electronics")
109
+ books = ItemService.list_items(item_service, "books")
110
+
111
+ # Clean up
112
+ Agent.stop(item_service)
113
+
114
+ %{
115
+ all_items: all_items,
116
+ electronics: electronics,
117
+ books: books,
118
+ total_items: length(all_items),
119
+ electronics_count: length(electronics),
120
+ books_count: length(books)
121
+ }
122
+ end
123
+ end
124
+
125
+ defmodule IntegrationExample do
126
+ @doc """
127
+ Runs a complete e-commerce scenario.
128
+ """
129
+ def run_full_scenario do
130
+ # Setup services
131
+ container = TestRepo.Services.create_service_container()
132
+ TestRepo.Services.setup_sample_data(container)
133
+
134
+ # Get sample data
135
+ {:ok, sample_user} = UserService.get_user(container.user_service, TestRepo.Services.sample_user_id())
136
+ {:ok, sample_item} = ItemService.get_item(container.item_service, TestRepo.Services.sample_item_id())
137
+
138
+ # Create additional items
139
+ {:ok, premium_item} = ItemService.create_item(
140
+ container.item_service,
141
+ "premium",
142
+ "Premium Product",
143
+ 99.99,
144
+ "premium"
145
+ )
146
+
147
+ # Create order with multiple items
148
+ order = OrderService.create_order("big_order", sample_user, [sample_item])
149
+ order_with_premium = OrderService.add_item_to_order(order, premium_item)
150
+
151
+ # Process through order lifecycle
152
+ processing_order = OrderService.process_order(order_with_premium)
153
+ final_order = OrderService.complete_order(processing_order)
154
+
155
+ # Serialize everything for output
156
+ serialized_user = TestRepo.Services.serialize_model(sample_user)
157
+ serialized_order = TestRepo.Services.serialize_model(final_order)
158
+
159
+ # Clean up
160
+ GenServer.stop(container.user_service)
161
+ Agent.stop(container.item_service)
162
+
163
+ %{
164
+ scenario: "full_ecommerce",
165
+ user: serialized_user,
166
+ order: serialized_order,
167
+ total_revenue: final_order.total,
168
+ items_sold: length(final_order.items)
169
+ }
170
+ end
171
+
172
+ @doc """
173
+ Demonstrates error handling scenarios.
174
+ """
175
+ def error_handling_example do
176
+ {:ok, user_service} = UserService.start_link()
177
+
178
+ # Try to create duplicate user
179
+ {:ok, _user1} = UserService.create_user(user_service, "dup", "User", "user@example.com")
180
+ duplicate_result = UserService.create_user(user_service, "dup", "Another User", "another@example.com")
181
+
182
+ # Try to get non-existent user
183
+ missing_user_result = UserService.get_user(user_service, "nonexistent")
184
+
185
+ # Try to delete non-existent user
186
+ delete_result = UserService.delete_user(user_service, "nonexistent")
187
+
188
+ GenServer.stop(user_service)
189
+
190
+ %{
191
+ duplicate_user_error: duplicate_result,
192
+ missing_user_error: missing_user_result,
193
+ delete_missing_error: delete_result
194
+ }
195
+ end
196
+ end
197
+
198
+ @doc """
199
+ Main function to run all examples.
200
+ """
201
+ def run_all_examples do
202
+ %{
203
+ user_management: UserManagement.run_user_example(),
204
+ role_management: UserManagement.manage_user_roles(),
205
+ shopping: ShoppingExample.run_shopping_example(),
206
+ item_filtering: ShoppingExample.item_filtering_example(),
207
+ integration: IntegrationExample.run_full_scenario(),
208
+ error_handling: IntegrationExample.error_handling_example()
209
+ }
210
+ end
211
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/models.ex ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo.Models do
2
+ @moduledoc """
3
+ Models module demonstrating various Elixir patterns including structs, protocols, and behaviours.
4
+ """
5
+
6
+ defprotocol Serializable do
7
+ @doc "Convert model to map representation"
8
+ def to_map(model)
9
+ end
10
+
11
+ defmodule User do
12
+ @type t :: %__MODULE__{
13
+ id: String.t(),
14
+ name: String.t() | nil,
15
+ email: String.t(),
16
+ roles: list(String.t())
17
+ }
18
+
19
+ defstruct [:id, :name, :email, roles: []]
20
+
21
+ @doc """
22
+ Creates a new user.
23
+
24
+ ## Examples
25
+
26
+ iex> TestRepo.Models.User.new("1", "Alice", "alice@example.com")
27
+ %TestRepo.Models.User{id: "1", name: "Alice", email: "alice@example.com", roles: []}
28
+
29
+ """
30
+ def new(id, name, email, roles \\ []) do
31
+ %__MODULE__{id: id, name: name, email: email, roles: roles}
32
+ end
33
+
34
+ @doc """
35
+ Checks if user has a specific role.
36
+ """
37
+ def has_role?(%__MODULE__{roles: roles}, role) do
38
+ role in roles
39
+ end
40
+
41
+ @doc """
42
+ Adds a role to the user.
43
+ """
44
+ def add_role(%__MODULE__{roles: roles} = user, role) do
45
+ %{user | roles: [role | roles]}
46
+ end
47
+ end
48
+
49
+ defmodule Item do
50
+ @type t :: %__MODULE__{
51
+ id: String.t(),
52
+ name: String.t(),
53
+ price: float(),
54
+ category: String.t()
55
+ }
56
+
57
+ defstruct [:id, :name, :price, :category]
58
+
59
+ @doc """
60
+ Creates a new item.
61
+
62
+ ## Examples
63
+
64
+ iex> TestRepo.Models.Item.new("1", "Widget", 19.99, "electronics")
65
+ %TestRepo.Models.Item{id: "1", name: "Widget", price: 19.99, category: "electronics"}
66
+
67
+ """
68
+ def new(id, name, price, category) do
69
+ %__MODULE__{id: id, name: name, price: price, category: category}
70
+ end
71
+
72
+ @doc """
73
+ Formats price for display.
74
+ """
75
+ def display_price(%__MODULE__{price: price}) do
76
+ "$#{:erlang.float_to_binary(price, decimals: 2)}"
77
+ end
78
+
79
+ @doc """
80
+ Checks if item is in a specific category.
81
+ """
82
+ def in_category?(%__MODULE__{category: category}, target_category) do
83
+ category == target_category
84
+ end
85
+ end
86
+
87
+ defmodule Order do
88
+ alias TestRepo.Models.{User, Item}
89
+
90
+ @type t :: %__MODULE__{
91
+ id: String.t(),
92
+ user: User.t(),
93
+ items: list(Item.t()),
94
+ total: float(),
95
+ status: atom()
96
+ }
97
+
98
+ defstruct [:id, :user, items: [], total: 0.0, status: :pending]
99
+
100
+ @doc """
101
+ Creates a new order.
102
+ """
103
+ def new(id, user, items \\ []) do
104
+ total = calculate_total(items)
105
+ %__MODULE__{id: id, user: user, items: items, total: total}
106
+ end
107
+
108
+ @doc """
109
+ Adds an item to the order.
110
+ """
111
+ def add_item(%__MODULE__{items: items} = order, item) do
112
+ new_items = [item | items]
113
+ %{order | items: new_items, total: calculate_total(new_items)}
114
+ end
115
+
116
+ @doc """
117
+ Updates order status.
118
+ """
119
+ def update_status(%__MODULE__{} = order, status) do
120
+ %{order | status: status}
121
+ end
122
+
123
+ defp calculate_total(items) do
124
+ Enum.reduce(items, 0.0, fn item, acc -> acc + item.price end)
125
+ end
126
+ end
127
+
128
+ # Protocol implementations
129
+ defimpl Serializable, for: User do
130
+ def to_map(%User{id: id, name: name, email: email, roles: roles}) do
131
+ %{id: id, name: name, email: email, roles: roles}
132
+ end
133
+ end
134
+
135
+ defimpl Serializable, for: Item do
136
+ def to_map(%Item{id: id, name: name, price: price, category: category}) do
137
+ %{id: id, name: name, price: price, category: category}
138
+ end
139
+ end
140
+
141
+ defimpl Serializable, for: Order do
142
+ def to_map(%Order{id: id, user: user, items: items, total: total, status: status}) do
143
+ %{
144
+ id: id,
145
+ user: Serializable.to_map(user),
146
+ items: Enum.map(items, &Serializable.to_map/1),
147
+ total: total,
148
+ status: status
149
+ }
150
+ end
151
+ end
152
+
153
+ @doc """
154
+ Factory function to create a sample user.
155
+ """
156
+ def create_sample_user do
157
+ User.new("sample", "Sample User", "sample@example.com", ["user"])
158
+ end
159
+
160
+ @doc """
161
+ Factory function to create a sample item.
162
+ """
163
+ def create_sample_item do
164
+ Item.new("sample", "Sample Item", 9.99, "sample")
165
+ end
166
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/services.ex ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo.Services do
2
+ @moduledoc """
3
+ Services module demonstrating function usage and dependencies.
4
+ Similar to Python's services.py, this module uses the models defined in TestRepo.Models.
5
+ """
6
+
7
+ alias TestRepo.Models.{User, Item, Order, Serializable}
8
+
9
+ defmodule UserService do
10
+ use GenServer
11
+
12
+ # Client API
13
+
14
+ @doc """
15
+ Starts the UserService GenServer.
16
+ """
17
+ def start_link(opts \\ []) do
18
+ GenServer.start_link(__MODULE__, %{}, opts)
19
+ end
20
+
21
+ @doc """
22
+ Creates a new user and stores it.
23
+ """
24
+ def create_user(pid, id, name, email, roles \\ []) do
25
+ GenServer.call(pid, {:create_user, id, name, email, roles})
26
+ end
27
+
28
+ @doc """
29
+ Gets a user by ID.
30
+ """
31
+ def get_user(pid, id) do
32
+ GenServer.call(pid, {:get_user, id})
33
+ end
34
+
35
+ @doc """
36
+ Lists all users.
37
+ """
38
+ def list_users(pid) do
39
+ GenServer.call(pid, :list_users)
40
+ end
41
+
42
+ @doc """
43
+ Deletes a user by ID.
44
+ """
45
+ def delete_user(pid, id) do
46
+ GenServer.call(pid, {:delete_user, id})
47
+ end
48
+
49
+ # Server callbacks
50
+
51
+ @impl true
52
+ def init(_) do
53
+ {:ok, %{}}
54
+ end
55
+
56
+ @impl true
57
+ def handle_call({:create_user, id, name, email, roles}, _from, users) do
58
+ if Map.has_key?(users, id) do
59
+ {:reply, {:error, "User with ID #{id} already exists"}, users}
60
+ else
61
+ user = User.new(id, name, email, roles)
62
+ new_users = Map.put(users, id, user)
63
+ {:reply, {:ok, user}, new_users}
64
+ end
65
+ end
66
+
67
+ @impl true
68
+ def handle_call({:get_user, id}, _from, users) do
69
+ case Map.get(users, id) do
70
+ nil -> {:reply, {:error, :not_found}, users}
71
+ user -> {:reply, {:ok, user}, users}
72
+ end
73
+ end
74
+
75
+ @impl true
76
+ def handle_call(:list_users, _from, users) do
77
+ user_list = Map.values(users)
78
+ {:reply, user_list, users}
79
+ end
80
+
81
+ @impl true
82
+ def handle_call({:delete_user, id}, _from, users) do
83
+ if Map.has_key?(users, id) do
84
+ new_users = Map.delete(users, id)
85
+ {:reply, :ok, new_users}
86
+ else
87
+ {:reply, {:error, :not_found}, users}
88
+ end
89
+ end
90
+ end
91
+
92
+ defmodule ItemService do
93
+ use Agent
94
+
95
+ @doc """
96
+ Starts the ItemService Agent.
97
+ """
98
+ def start_link(opts \\ []) do
99
+ Agent.start_link(fn -> %{} end, opts)
100
+ end
101
+
102
+ @doc """
103
+ Creates a new item and stores it.
104
+ """
105
+ def create_item(pid, id, name, price, category) do
106
+ Agent.get_and_update(pid, fn items ->
107
+ if Map.has_key?(items, id) do
108
+ {{:error, "Item with ID #{id} already exists"}, items}
109
+ else
110
+ item = Item.new(id, name, price, category)
111
+ new_items = Map.put(items, id, item)
112
+ {{:ok, item}, new_items}
113
+ end
114
+ end)
115
+ end
116
+
117
+ @doc """
118
+ Gets an item by ID.
119
+ """
120
+ def get_item(pid, id) do
121
+ Agent.get(pid, fn items ->
122
+ case Map.get(items, id) do
123
+ nil -> {:error, :not_found}
124
+ item -> {:ok, item}
125
+ end
126
+ end)
127
+ end
128
+
129
+ @doc """
130
+ Lists all items, optionally filtered by category.
131
+ """
132
+ def list_items(pid, category \\ nil) do
133
+ Agent.get(pid, fn items ->
134
+ item_list = Map.values(items)
135
+
136
+ case category do
137
+ nil -> item_list
138
+ cat -> Enum.filter(item_list, &Item.in_category?(&1, cat))
139
+ end
140
+ end)
141
+ end
142
+
143
+ @doc """
144
+ Deletes an item by ID.
145
+ """
146
+ def delete_item(pid, id) do
147
+ Agent.get_and_update(pid, fn items ->
148
+ if Map.has_key?(items, id) do
149
+ new_items = Map.delete(items, id)
150
+ {:ok, new_items}
151
+ else
152
+ {{:error, :not_found}, items}
153
+ end
154
+ end)
155
+ end
156
+ end
157
+
158
+ defmodule OrderService do
159
+ @doc """
160
+ Creates a new order.
161
+ """
162
+ def create_order(id, user, items \\ []) do
163
+ Order.new(id, user, items)
164
+ end
165
+
166
+ @doc """
167
+ Adds an item to an existing order.
168
+ """
169
+ def add_item_to_order(order, item) do
170
+ Order.add_item(order, item)
171
+ end
172
+
173
+ @doc """
174
+ Updates the status of an order.
175
+ """
176
+ def update_order_status(order, status) do
177
+ Order.update_status(order, status)
178
+ end
179
+
180
+ @doc """
181
+ Processes an order (changes status to :processing).
182
+ """
183
+ def process_order(order) do
184
+ update_order_status(order, :processing)
185
+ end
186
+
187
+ @doc """
188
+ Completes an order (changes status to :completed).
189
+ """
190
+ def complete_order(order) do
191
+ update_order_status(order, :completed)
192
+ end
193
+
194
+ @doc """
195
+ Cancels an order (changes status to :cancelled).
196
+ """
197
+ def cancel_order(order) do
198
+ update_order_status(order, :cancelled)
199
+ end
200
+ end
201
+
202
+ @doc """
203
+ Factory function to create a service container.
204
+ """
205
+ def create_service_container do
206
+ {:ok, user_service} = UserService.start_link()
207
+ {:ok, item_service} = ItemService.start_link()
208
+
209
+ %{
210
+ user_service: user_service,
211
+ item_service: item_service,
212
+ order_service: OrderService
213
+ }
214
+ end
215
+
216
+ @doc """
217
+ Helper function to serialize any model that implements the Serializable protocol.
218
+ """
219
+ def serialize_model(model) do
220
+ Serializable.to_map(model)
221
+ end
222
+
223
+ # Module-level variables for testing
224
+ @sample_user_id "sample_user"
225
+ @sample_item_id "sample_item"
226
+
227
+ @doc """
228
+ Gets the sample user ID.
229
+ """
230
+ def sample_user_id, do: @sample_user_id
231
+
232
+ @doc """
233
+ Gets the sample item ID.
234
+ """
235
+ def sample_item_id, do: @sample_item_id
236
+
237
+ # Create some sample data at module load time
238
+ def setup_sample_data(container) do
239
+ # Create sample user
240
+ UserService.create_user(
241
+ container.user_service,
242
+ @sample_user_id,
243
+ "Sample User",
244
+ "sample@example.com",
245
+ ["user", "customer"]
246
+ )
247
+
248
+ # Create sample item
249
+ ItemService.create_item(
250
+ container.item_service,
251
+ @sample_item_id,
252
+ "Sample Widget",
253
+ 29.99,
254
+ "electronics"
255
+ )
256
+ end
257
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/test_repo.ex ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo do
2
+ @moduledoc """
3
+ Documentation for `TestRepo`.
4
+ """
5
+
6
+ @doc """
7
+ Hello world.
8
+
9
+ ## Examples
10
+
11
+ iex> TestRepo.hello()
12
+ :world
13
+
14
+ """
15
+ def hello do
16
+ :world
17
+ end
18
+
19
+ @doc """
20
+ Adds two numbers together.
21
+
22
+ ## Examples
23
+
24
+ iex> TestRepo.add(2, 3)
25
+ 5
26
+
27
+ """
28
+ def add(a, b) do
29
+ a + b
30
+ end
31
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/utils.ex ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo.Utils do
2
+ @moduledoc """
3
+ Utility functions for TestRepo.
4
+ """
5
+
6
+ @doc """
7
+ Converts a string to uppercase.
8
+
9
+ ## Examples
10
+
11
+ iex> TestRepo.Utils.upcase("hello")
12
+ "HELLO"
13
+
14
+ """
15
+ def upcase(string) when is_binary(string) do
16
+ String.upcase(string)
17
+ end
18
+
19
+ @doc """
20
+ Calculates the factorial of a number.
21
+
22
+ ## Examples
23
+
24
+ iex> TestRepo.Utils.factorial(5)
25
+ 120
26
+
27
+ """
28
+ def factorial(0), do: 1
29
+ def factorial(n) when n > 0 do
30
+ n * factorial(n - 1)
31
+ end
32
+
33
+ @doc """
34
+ Checks if a number is even.
35
+
36
+ ## Examples
37
+
38
+ iex> TestRepo.Utils.even?(4)
39
+ true
40
+
41
+ iex> TestRepo.Utils.even?(3)
42
+ false
43
+
44
+ """
45
+ def even?(n) when is_integer(n) do
46
+ rem(n, 2) == 0
47
+ end
48
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/mix.exs ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ defmodule TestRepo.MixProject do
2
+ use Mix.Project
3
+
4
+ def project do
5
+ [
6
+ app: :test_repo,
7
+ version: "0.1.0",
8
+ elixir: "~> 1.14",
9
+ start_permanent: Mix.env() == :prod,
10
+ deps: deps()
11
+ ]
12
+ end
13
+
14
+ def application do
15
+ [
16
+ extra_applications: [:logger]
17
+ ]
18
+ end
19
+
20
+ defp deps do
21
+ [
22
+ {:credo, "~> 1.7", only: [:dev, :test], runtime: false}
23
+ ]
24
+ end
25
+ end
projects/ui/serena-new/test/resources/repos/elixir/test_repo/mix.lock ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ %{
2
+ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
3
+ "credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"},
4
+ "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
5
+ "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
6
+ }