Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
a7471310
Commit
a7471310
authored
Feb 01, 2019
by
Hero Bird
Browse files
[pdsl] Remove pdsl_tests
parent
bfcafb54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Cargo.toml
View file @
a7471310
...
...
@@ -3,7 +3,6 @@
members
=
[
"pdsl_core"
,
# "pdsl_derive",
"pdsl_tests"
,
]
exclude
=
[
"examples/"
,
...
...
pdsl_tests/Cargo.toml
deleted
100644 → 0
View file @
bfcafb54
[package]
name
=
"pdsl_tests"
version
=
"0.1.0"
authors
=
[
"Robin Freyler <robbepop@web.de>"
]
edition
=
"2018"
description
=
"Tests for the Substrate smart constracts Rust eDSL"
license
=
"GPL-3.0"
# readme = "README.md"
# repository = "https://github.com/robbepop/pdsl"
# documentation = "https://docs.rs/pdsl"
# homepage =
# keywords = []
# categories = []
[lib]
crate-type
=
["cdylib"]
name
=
"pdsl_tests"
[dependencies]
pdsl_core
=
{
path
=
"../pdsl_core"
}
parity-codec
=
{
version
=
"2.2"
,
default-features
=
false
,
features
=
["derive"]
}
[features]
test-env
=
["pdsl_core/test-env"]
pdsl_tests/src/lib.rs
deleted
100644 → 0
View file @
bfcafb54
#![no_std]
pub
mod
incrementer
{
use
pdsl_core
::{
env
::{
Env
,
ContractEnv
},
storage
::{
alloc
,
Key
,
cell
::
SyncCell
,
},
};
#[derive(parity_codec::Encode,
parity_codec::Decode)]
enum
Action
{
Inc
(
u32
),
Get
,
}
const
ALLOC_KEY
:
Key
=
Key
([
0x0
;
32
]);
#[no_mangle]
pub
extern
"C"
fn
deploy
()
{
unsafe
{
let
mut
alloc
=
alloc
::
BumpAlloc
::
from_raw_parts
(
ALLOC_KEY
);
SyncCell
::
new_using_alloc
(
&
mut
alloc
)
.set
(
0
)
}
}
#[no_mangle]
pub
extern
"C"
fn
call
()
{
use
parity_codec
::{
Decode
,
Encode
};
let
input
=
ContractEnv
::
input
();
let
action
=
Action
::
decode
(
&
mut
&
input
[
..
])
.unwrap
();
let
mut
counter
=
unsafe
{
let
mut
alloc
=
alloc
::
BumpAlloc
::
from_raw_parts
(
ALLOC_KEY
);
SyncCell
::
new_using_alloc
(
&
mut
alloc
)
};
match
action
{
Action
::
Inc
(
by
)
=>
{
counter
.mutate_with
(|
counter
|
*
counter
+=
by
);
}
Action
::
Get
=>
{
ContractEnv
::
return_
(
&
counter
.get
()
.unwrap_or
(
&
0
)
.encode
()
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment