Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dunixir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
teaching
dunixir
Commits
23792ee3
Commit
23792ee3
authored
Mar 1, 2021
by
x18zhan2
Browse files
Options
Downloads
Patches
Plain Diff
implements:
#37
parent
5def047c
No related branches found
No related tags found
No related merge requests found
Pipeline
#1329
failed
Mar 1, 2021
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/local_augmentation_example.ex
+32
-1
32 additions, 1 deletion
lib/local_augmentation_example.ex
test/block/augmentation/issuers_frame_test.exs
+53
-0
53 additions, 0 deletions
test/block/augmentation/issuers_frame_test.exs
with
85 additions
and
1 deletion
lib/local_augmentation_example.ex
+
32
−
1
View file @
23792ee3
...
...
@@ -52,6 +52,38 @@ defmodule Index.Augmentation do
end
end
## BR_G05
def
issuersFrame
(
global_bindex
,
local_bindex
)
do
[{
key
,
head
}]
=
find_first_local_bindex_entry
(
local_bindex
)
if
head
.
number
==
0
do
:ets
.
insert
(
local_bindex
,
{
key
,
Map
.
merge
(
head
,
%{
issuersFrame:
1
})})
else
[[
head_1_id
]]
=
:dets
.
match
(
global_bindex
,
{
:"$1"
,
%{
number:
head
.
number
-
1
}})
[{
_key_1
,
head_1
}]
=
:dets
.
lookup
(
global_bindex
,
head_1_id
)
cond
do
head_1
.
issuersFrameVar
>
0
->
:ets
.
insert
(
local_bindex
,
{
key
,
Map
.
merge
(
head
,
%{
issuersFrame:
head_1
.
issuersFrame
+
1
})}
)
head_1
.
issuersFrameVar
<
0
->
:ets
.
insert
(
local_bindex
,
{
key
,
Map
.
merge
(
head
,
%{
issuersFrame:
head_1
.
issuersFrame
-
1
})}
)
true
->
:ets
.
insert
(
local_bindex
,
{
key
,
Map
.
merge
(
head
,
%{
issuersFrame:
head_1
.
issuersFrame
})}
)
end
end
end
## BR_G06
def
issuersFrameVar
(
global_bindex
,
local_bindex
)
do
key
=
:ets
.
first
(
local_bindex
)
...
...
@@ -73,7 +105,6 @@ defmodule Index.Augmentation do
end
end
## BR_G10
def
membersCount
(
local_iindex
,
global_bindex
,
local_bindex
)
do
key
=
:ets
.
first
(
local_bindex
)
...
...
This diff is collapsed.
Click to expand it.
test/block/augmentation/issuers_frame_test.exs
0 → 100644
+
53
−
0
View file @
23792ee3
defmodule
Block
.
Augmentation
.
IssuersFrameTest
do
use
ExUnit
.
Case
doctest
Index
.
Augmentation
.
BIndex
setup_all
do
local_bindex
=
:ets
.
new
(
:local_bindex
,
[
:set
,
:protected
])
:file
.
delete
(
"test/global_bindex"
)
{
:ok
,
global_bindex
}
=
:dets
.
open_file
(
:"test/global_bindex"
,
type:
:set
)
:dets
.
insert
(
global_bindex
,
{
2
,
%{
number:
2
,
issuersFrameVar:
0
,
issuersFrame:
5
}})
:dets
.
insert
(
global_bindex
,
{
1
,
%{
number:
1
,
issuersFrameVar:
-
1
,
issuersFrame:
5
}})
:dets
.
insert
(
global_bindex
,
{
0
,
%{
number:
0
,
issuersFrameVar:
1
,
issuersFrame:
5
}})
:ets
.
insert
(
local_bindex
,
{
4
,
%{
number:
0
}})
Index
.
Augmentation
.
BIndex
.
issuersFrame
(
global_bindex
,
local_bindex
)
[{
4
,
head
}]
=
:ets
.
lookup
(
local_bindex
,
4
)
issuersFrame0
=
head
.
issuersFrame
:ets
.
insert
(
local_bindex
,
{
4
,
%{
number:
1
}})
Index
.
Augmentation
.
BIndex
.
issuersFrame
(
global_bindex
,
local_bindex
)
[{
4
,
head
}]
=
:ets
.
lookup
(
local_bindex
,
4
)
issuersFrame1
=
head
.
issuersFrame
:ets
.
insert
(
local_bindex
,
{
4
,
%{
number:
2
}})
Index
.
Augmentation
.
BIndex
.
issuersFrame
(
global_bindex
,
local_bindex
)
[{
4
,
head
}]
=
:ets
.
lookup
(
local_bindex
,
4
)
issuersFrame2
=
head
.
issuersFrame
:ets
.
insert
(
local_bindex
,
{
4
,
%{
number:
3
}})
Index
.
Augmentation
.
BIndex
.
issuersFrame
(
global_bindex
,
local_bindex
)
[{
4
,
head
}]
=
:ets
.
lookup
(
local_bindex
,
4
)
issuersFrame3
=
head
.
issuersFrame
:dets
.
close
(
global_bindex
)
:file
.
delete
(
"test/global_bindex"
)
{
:ok
,
issuersFrame0:
issuersFrame0
,
issuersFrame1:
issuersFrame1
,
issuersFrame2:
issuersFrame2
,
issuersFrame3:
issuersFrame3
}
end
test
"check issuersFrame"
,
state
do
assert
state
.
issuersFrame0
==
1
assert
state
.
issuersFrame1
==
6
assert
state
.
issuersFrame2
==
4
assert
state
.
issuersFrame3
==
5
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment