-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add morph types to MiniLcm #1857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
636cc22
Add MorphType enum and MorphTypeData class
rmunn 0902538
Set morph type when ILexEntry is created
rmunn 2163a67
Add get methods for morph types to read API
rmunn 3f342bd
Add write API methods for MorphTypeData
rmunn e4847c0
CrdtMiniLcmApi methods for morph types should throw
rmunn 06c3d0d
Fix bug in SimpleStringDiff and IntegerDiff
rmunn 52f9007
Implement necessary methods in dry run and legacy
rmunn 6b537ef
Address review comments
rmunn 92a0d4e
Add DB migration for CRDT database
rmunn 5a3fdd3
Update VerifyDbModel
rmunn 7b21ee4
Persist and update morph type in CRDT
myieye 1078874
Fix linting errors
myieye 2f5d426
Make AutoFaker exclude Unknown and Other, because they don't round trip
myieye c95af0c
Explicitly default to MorphType.Stem in several places
myieye ba7a647
Handle undocumented nullability of ILexEntry.PrimaryMorphType
myieye 31218de
Exclude MorphType from AllObjectsAreRegistered test
rmunn fc34c25
Exclude correct type
rmunn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
backend/FwLite/FwDataMiniLcmBridge/Api/UpdateProxy/UpdateMorphTypeDataProxy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using MiniLcm.Models; | ||
using SIL.LCModel; | ||
|
||
namespace FwDataMiniLcmBridge.Api.UpdateProxy; | ||
|
||
public class UpdateMorphTypeDataProxy : MorphTypeData | ||
{ | ||
private readonly IMoMorphType _lcmMorphType; | ||
private readonly FwDataMiniLcmApi _lexboxLcmApi; | ||
|
||
public UpdateMorphTypeDataProxy(IMoMorphType lcmMorphType, FwDataMiniLcmApi lexboxLcmApi) | ||
{ | ||
_lcmMorphType = lcmMorphType; | ||
Id = lcmMorphType.Guid; | ||
_lexboxLcmApi = lexboxLcmApi; | ||
} | ||
|
||
public override MultiString Name | ||
{ | ||
get => new UpdateMultiStringProxy(_lcmMorphType.Name, _lexboxLcmApi); | ||
set => throw new NotImplementedException(); | ||
} | ||
|
||
public override MultiString Abbreviation | ||
{ | ||
get => new UpdateMultiStringProxy(_lcmMorphType.Abbreviation, _lexboxLcmApi); | ||
set => throw new NotImplementedException(); | ||
} | ||
|
||
public override RichMultiString Description | ||
{ | ||
get => new UpdateRichMultiStringProxy(_lcmMorphType.Description, _lexboxLcmApi); | ||
set => throw new NotImplementedException(); | ||
} | ||
|
||
public override string LeadingToken | ||
{ | ||
get => _lcmMorphType.Prefix; | ||
set => _lcmMorphType.Prefix = value; | ||
} | ||
|
||
public override string TrailingToken | ||
{ | ||
get => _lcmMorphType.Postfix; | ||
set => _lcmMorphType.Postfix = value; | ||
} | ||
|
||
public override int SecondaryOrder | ||
{ | ||
get => _lcmMorphType.SecondaryOrder; | ||
set => _lcmMorphType.SecondaryOrder = value; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
backend/FwLite/FwLiteProjectSync.Tests/IntegerDiffTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using MiniLcm.SyncHelpers; | ||
using SystemTextJsonPatch.Operations; | ||
|
||
namespace FwLiteProjectSync.Tests; | ||
|
||
public class IntegerDiffTests | ||
{ | ||
private record Placeholder(); | ||
|
||
[Fact] | ||
public void DiffEmptyIntegersDoNothing() | ||
{ | ||
int? before = null; | ||
int? after = null; | ||
var result = IntegerDiff.GetIntegerDiff<Placeholder>("test", before, after); | ||
result.Should().BeEmpty(); | ||
} | ||
|
||
[Fact] | ||
public void DiffOneToEmptyAddsOne() | ||
{ | ||
int? before = null; | ||
var after = 1; | ||
var result = IntegerDiff.GetIntegerDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("add", "/test", null, 1) | ||
]); | ||
} | ||
|
||
[Fact] | ||
public void DiffOneToTwoReplacesOne() | ||
{ | ||
var before = 1; | ||
var after = 2; | ||
var result = IntegerDiff.GetIntegerDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("replace", "/test", null, 2) | ||
]); | ||
} | ||
|
||
[Fact] | ||
public void DiffNoneToOneRemovesOne() | ||
{ | ||
var before = 1; | ||
int? after = null; | ||
var result = IntegerDiff.GetIntegerDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("remove", "/test", null) | ||
]); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using MiniLcm.SyncHelpers; | ||
using SystemTextJsonPatch.Operations; | ||
|
||
namespace FwLiteProjectSync.Tests; | ||
|
||
public class SimpleStringDiffTests | ||
{ | ||
private record Placeholder(); | ||
|
||
[Fact] | ||
public void DiffEmptyStringsDoNothing() | ||
{ | ||
string? before = null; | ||
string? after = null; | ||
var result = SimpleStringDiff.GetStringDiff<Placeholder>("test", before, after); | ||
result.Should().BeEmpty(); | ||
} | ||
|
||
[Fact] | ||
public void DiffOneToEmptyAddsOne() | ||
{ | ||
string? before = null; | ||
var after = "hello"; | ||
var result = SimpleStringDiff.GetStringDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("add", "/test", null, "hello") | ||
]); | ||
} | ||
|
||
[Fact] | ||
public void DiffOneToOneReplacesOne() | ||
{ | ||
var before = "hello"; | ||
var after = "world"; | ||
var result = SimpleStringDiff.GetStringDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("replace", "/test", null, "world") | ||
]); | ||
} | ||
|
||
[Fact] | ||
public void DiffNoneToOneRemovesOne() | ||
{ | ||
var before = "hello"; | ||
string? after = null; | ||
var result = SimpleStringDiff.GetStringDiff<Placeholder>("test", before, after); | ||
result.Should().BeEquivalentTo([ | ||
new Operation<Placeholder>("remove", "/test", null) | ||
]); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.